date used for comparison with relative dates. Useful to set for tests
React contents
The default locale used to format dates
Returns a <time> component with the formatted distance to the specified date
date
, includeSeconds
, addSuffix
and locale
. Passed to formatDistance
Returns a <time> component with the strict formatted distance to the specified date
date
, addSuffix
, unit
, roundingMethod
and locale
. Passed to formatDistanceStrict
Returns a <time> component with the formatted relative to the specified date
date
, weekStartsOn
and locale
. Passed to formatRelative
Performs the argument calculation periodically and returns the result as
React state. The frequency of the calculation depends on the difference
between the date
argument and the baseDate
(default: current date).
When the date is close to now, the calculation
recalculates more
frequently. At most calls calculation
about once per second. If
baseDate
is provided, the value is only calculated once and never update.
The date used for date-fns calculations. Passed to calculation
A function used to calculate the target value
The calculation is passed the date
, a baseDate
and the locale
baseDate
and locale
used to override the context or current
date (optional). If baseDate
is provided, the result is never updated
Calls the formatDistance
function from date-fns periodically, updating
the returned value when needed
value passed to date-fns formatDistance
includeSeconds
, addSuffix
and locale
. Passed to formatDistance
Calls the formatDistanceStrict
function from date-fns periodically, updating
the returned value when needed
value passed to date-fns formatDistance
addSuffix
, unit
, roundingMethod
and locale
. Passed to formatDistanceStrict
Calls the formatRelative
function from date-fns periodically, updating
the returned value when needed
value passed to date-fns formatRelative
weekStartsOn
and locale
. Passed to formatRelative
Generated using TypeDoc
A React Context for date-fns functionality. Used to override locale and to set the baseDate for testing purposes.