0.1.0 • Published 4 years ago

@lukaswhite/durations-js v0.1.0

Weekly downloads
1
License
ISC
Repository
-
Last release
4 years ago

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
0.1.0

4 years ago