Skip to content

Date and time library with iana timezones support

Notifications You must be signed in to change notification settings

datetime-js/datetime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DateTime

DateTime is a lightweight and performant date and time library with iana timezones support.

Motivation

DateTime does not use native Date object. Instead it uses pre-parsed IANA Time Zone Database directly from JavaScript. That allows to keep it predictable, reliable, and future proof on any platform.

Key features

  • Supports ISO-8601 standard, including intervals and durations
  • Supports timezones and DST
  • Works in any browser on any platform independently from the native Date
  • Very fast
  • Small size – only 10 KB compressed
  • No dependencies
  • 99% covered with unit tests

API documentation

Coming soon.

Performance

DateTime is much faster than any other library with timezones support:

Create a new instance with an array
==================================================================
DateTime × 782,154 ops/sec
MomentJS × 260,938 ops/sec
MomentJS + Timezones × 49,593 ops/sec
Fastest is DateTime

Create a new instance with a string
==================================================================
DateTime × 383,795 ops/sec
MomentJS × 34,681 ops/sec
MomentJS with timezones × 20,491 ops/sec
js-joda with timezones × 20,153 ops/sec
Fastest is DateTime

Create a new instance with a string and format
==================================================================
DateTime × 504,000 ops/sec
MomentJS × 38,349 ops/sec
MomentJS + Timezones × 21,643 ops/sec
Fastest is DateTime

Check datetime-benchmark for details.

Licence

MIT