Not a Penny More

    @lukaswhite/durations-js

    0.1.0 • Public • Published

    Durations JS

    A small JS library for working with durations.

    Basic Usage

    let duration = new Duration( { hours: 2, minutes: 30 } )
    console.log( duration.toSeconds( ) )
    console.log( duration.humanize( ) )

    ISO 8601

    You can create an instance from an ISO 8601 duration string:

    let duration = Duration.fromISO8601('P1Y2M4DT20H44M12.67S')

    You can also convert to ISO 8601:

    let duration = new Duration( { days : 6, hours: 3 } )
    console.log( duration.toISO801String( ) ) // P6DT3H

    Keywords

    none

    Install

    npm i @lukaswhite/durations-js

    DownloadsWeekly Downloads

    2

    Version

    0.1.0

    License

    ISC

    Unpacked Size

    73.6 kB

    Total Files

    11

    Last publish

    Collaborators

    • lukaswhite