Skip to content

@technobuddha > library > Time > Relative Time

Function: relativeTime()

ts
function relativeTime(
   input: Date, 
   relativeTo: Date, 
   options: RelativeTimeOptions): string;

Defined in: relative-time.ts:34

Describe the difference between two dates in a simple format

Parameters

ParameterTypeDescription
inputDateThe date
relativeToDateThe date to compare to
optionsRelativeTimeOptionssee RelativeTimeOptions

Returns

string

string describing the time difference between the two dates