The design choices are centered around ease of use, rather than compatibility, and browser bundling.
The DateTz object treats 1
as the first month of the year, rather than 0
for the built in Date class.
The Date object treats 0
as Sunday, and this library accepts that convention.
This means functions like startOfWeek will return Sunday rather than Monday.
The addDays function has no complimentary subDays
function, as this can
be achieved by making the days
argument negative.
While classes might provide a more elegant interface, few tree shaking libraries and able to prune unused class methods, so functions are preferred to classes.
This may change, but the current view is that the majority of developers
use bundlers, rather than include manual <script>
tags. With this in
mind the code is provided as a single javascript file, as the downstream
bundler will do the tree shaking.
Generated using TypeDoc