sp core library.itimeprovider - microsoft/Viva-Connections-Extensibility-Beta GitHub Wiki

Home > @microsoft/sp-core-library > ITimeProvider

ITimeProvider interface

This is a ServiceScope contract for reading the system clock.

Signature:

export interface ITimeProvider

Remarks

This interface abstracts the functionality of the system time APIs for usage with a ServiceScope. For example, a unit test might replace the default TimeProvider service with a mock implementation that follows a manually incremented timeline, in order to ensure that test failures are always repeatable.

Methods

Method Description
getDate() Returns the current date/time, similar to the Date class constructor.
getTimestamp() Returns a DOMHighResTimeStamp timing measurement, as defined by the standard performance.now() API.
⚠️ **GitHub.com Fallback** ⚠️