The TimeSpan class is used for representing time interval. TimeSpan cannot be negative.

IMPORT_PATH: "@daiso-tech/core/time-span"

Implements

Methods

  • Create a TimeSpan from string

    Parameters

    • timeAsStr: string

    Returns TimeSpan

    // Will be 5000 milliseconds.
    TimeSpan.fromStr("5s").toMilliseconds()

    Under the hood, this method leverages @lukeed/ms package to convert various time formats into milliseconds. Refer to its documentation for a complete list of supported time formats and units.