TimeKeeper.js
A simple date-time library.
Features
- simple api
- no support milliseconds.
- no support day of weeks.
- no support DST: daylight saving time (summer time).
- no flexible formatter.
- no invalid state.
- no mutable state.
- typescript support
Installation
$ npm install time-keeper
Example
;; // You can also use import by function.// import { get } from 'time-keeper/get';// import { inTimeZone } from 'time-keeper/in-time-zone';// import { isLeapYear } from 'time-keeper/is-leap-year';// import { now } from 'time-keeper/now';// import { parseISOString } from 'time-keeper/parse-iso-string';// import { parseUNIXTime } from 'time-keeper/parse-unix-time';// import { plus } from 'time-keeper/plus';// import { toISOString } from 'time-keeper/to-iso-string';// import { toTimeZoneOffsetString } from 'time-keeper/to-time-zone-offset-string';// import { toUNIXTime } from 'time-keeper/to-unix-time'; ;;asserttoUNIXTimedt1 === toUNIXTimedt2; ;assertgetdt3, 'year' === 2006;assertgetdt3, 'month' === 6;assertgetdt3, 'date' === 17;assertgetdt3, 'hour' === 23;assertgetdt3, 'minute' === 28;assertgetdt3, 'second' === 40;asserttoTimeZoneOffsetStringdt3 === '+09:00';assertisLeapYeardt3 === false; ;asserttoISOStringdt3 === '2006-06-17T23:28:40+09:00';asserttoISOStringdt4 === '2006-06-17T16:28:40+02:00'; ;asserttoISOStringdt4 === '2006-06-17T16:28:40+02:00';asserttoISOStringdt5 === '2006-06-19T16:28:40+02:00';
See: src/
.