1.6.5 • Published 4 years ago
drivetribe-date-formatters v1.6.5
drivetribe-date-formatters
Collection of date formatter functions to format ISO dates for display purposes.
Install
Install the module directly from npm:
npm install drivetribe-date-formatters --save
Formatters
Relative Date
Converts ISO date or Unix timestamp to a relative date like "just now" or "5 days ago".
relativeDate(date: number||string): string
Convert seconds to duration
Converts a time, given in seconds, to a human-readable duration in the HH:MM:SS format.
convertSecondsToDuration(seconds: number): string
Time format
Converts ISO date or Unix timestamp to the next time format: HH:MMpm/am according to user timezone.
formatTime(date: number||string): string