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
    • Optional timestamp: 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.

      • Optional day?: number
      • Optional hour?: number
      • Optional microsecond?: number
      • Optional millisecond?: number
      • Optional minute?: number
      • Optional month?: number
      • Optional second?: number
      • Optional year?: 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

    Throws

    DwnError if timestamp is not a valid number