time.ts

The code defines a series of functions related to time. The constant conversionFns, converts days, hours, minutes, and seconds into seconds. The function, toSeconds, converts a given amount of time in a given unit into seconds. The second function, unixTimeInSeconds, returns the current time in Unix time (i.e. the number of seconds since January 1, 1970). The third function, calcExpiry, calculates when a given duration will expire. The final function, formatPeriods, formats a given duration into a more human-readable form.

Constants

  • conversionFns

Functions

  • toSeconds
  • unixTimeInSeconds
  • calcExpiry
  • formatPeriods