Immutable, Intuitive and Chainable
All operations return new instances for safe, predictable data and intuitive API.
Covers the majority of common use cases.
A 4kB JavaScript date library with 100+ APIs and strict DST guarantees.
Designed for single-timezone applications.
npm install qronobunx jsr add @urin/qronodeno add jsr:@urin/qrono<script src="https://unpkg.com/qrono/dist/qrono.min.js"></script>import { qrono } from 'qrono'
// UTC-first
const now = qrono().toString() // '2027-01-23T12:34:56:789Z'
// DST overlap (occurs twice) of Europe/London
qrono.context({ localtime: true })
const t = '2019-10-27T01:30:00'
qrono(t) // 01:30 +00:00 Same as JavaScript's `Date`
qrono({ disambiguation: 'earlier' }, t) // 01:30 +00:00
qrono({ disambiguation: 'later' }, t) // 01:30 +01:00
qrono({ disambiguation: 'reject' }, t) // throws RangeError
now.plus(0, 1, 10) // +1 month, +10 days
now.startOfMonth()
now.isBetween(qrono('2024-01-01'), qrono('2024-12-31'))
const date = qrono.date('2024-06-15')
date.dayOfYear() // 167
date.weekOfYear() // 24
date.endOfMonth() // 2024-06-30