Skip to content
This repository has been archived by the owner on Oct 23, 2021. It is now read-only.

sp core library.itimeprovider

John Nguyen edited this page Apr 22, 2021 · 2 revisions

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.
Clone this wiki locally