Time related utilities.

Constructors

Methods

  • Creates a UTC ISO-8601 timestamp offset from now or given timestamp accepted by DWN.

    Parameters

    • offset: {
          seconds: number;
      }

      Negative number means offset into the past.

      • seconds: number
    • Optionaltimestamp: string

    Returns string

  • Creates a UTC ISO-8601 timestamp in microsecond precision accepted by DWN.

    Parameters

    • options: {
          day?: number;
          hour?: number;
          microsecond?: number;
          millisecond?: number;
          minute?: number;
          month?: number;
          second?: number;
          year?: number;
      }

      Options for creating the timestamp.

      • Optionalday?: number
      • Optionalhour?: number
      • Optionalmicrosecond?: number
      • Optionalmillisecond?: number
      • Optionalminute?: number
      • Optionalmonth?: number
      • Optionalsecond?: number
      • Optionalyear?: number

    Returns string

    string

  • Returns an UTC ISO-8601 timestamp with microsecond precision accepted by DWN. using @js-temporal/polyfill

    Returns string

  • sleeps for the desired duration

    Parameters

    • durationInMillisecond: number

      the desired amount of sleep time

    Returns Promise<void>

    when the provided duration has passed

  • Validates that the provided timestamp is a valid number

    Parameters

    • timestamp: string

      the timestamp to validate

    Returns void

    DwnError if timestamp is not a valid number