Date functions
Functions related to dates and time
- Source:
date.utils.ts
formatTime(time, maxLength, allowAffixes)
Format a time
Parameters
- time - Time in milliseconds (negative number represents time in the past)
- Type:
number
- Type:
- maxLength - The maximum amount of units, e.g.: 3 => years, months, days
- Type:
number | undefined
- Default:
3
- Type:
- allowAffixes - Allow "... ago" or "in ..."
- Type:
boolean
- Type:
Returns
- Type:
string
formatRelativeTime(date, maxLength, allowAffixes)
Format a time relative to now
Parameters
- date
- Type:
Date
- Type:
- maxLength - The maximum amount of units, e.g.: 3 => years, months, days
- Type:
number | undefined
- Default:
3
- Default:
- Type:
- allowAffixes - Allow "... ago" or "in ..."
- Type:
boolean
- Type:
Returns
- Type:
string