v0.6.0
daymath is built on temporal-polyfill/fns instead of the Temporal class. Nothing a caller can observe changes, and the bundle drops by a third.
Changed
- A class is one unit to a bundler — it cannot prove a method unreachable — so the class build shipped whole for the twenty-odd Temporal operations daymath uses. Free functions drop what is not called. Measured by
npm run sizein one run: the three-call program goes 24,735 B gzip to 16,295 B, −34%; the whole surface 27,304 to 21,550, −21%; the three-call program plusday()25,269 to 19,349, −23%. - daymath no longer reads
globalThis.Temporalat all. The selection block 0.5.0 added is deleted.fnspicks its own implementation, and it defers to native where the runtime has one — Node 26 and Deno run native, Node 20 through 24 and Bun run the bundled build. That is whattemporal-polyfill/fullfailed to do, and it is why the hand-rolled selection could go rather than be ported. - The calendar resolver is
getAny, which carries every calendar's data. A narrower resolver would have been a defect: it drops the[u-ca=…]annotation on runtimes without native Temporal, so the same program would answer2569on Node 26 and2026on Node 20. It is the same 4.2 kB the calendars cost in 0.5.0, paid at a different layer rather than saved.
Fixed
differenceInDaysno longer uses thefnsdiffDaysconvenience.PlainDate's minimum is-271821-04-19, one day belowPlainDateTime's, anddiffDaysconverts to aPlainDateTimeand inherits the narrower limit, so it refused that one operand.diffwithlargestUnit: 'day'does not convert and answers what the class API answered.
Verified
- The battery ran against both implementations in one process and the rows were compared one by one: 69 exports, 62,928 calls, 0 differences. The cross-runtime baseline is unchanged and passes on Node 26.7.0, Deno 2.9.5 and Bun 1.3.14 — re-recording it would have hidden exactly this.
test.jsis unedited, which is the point: had a test needed changing, the behaviour would have changed.
Housekeeping
SECURITY.mdnow says 0.6.x. It had been stale at 0.2.x through three releases.
Upgrading from 0.5.0 needs no code change.
Full detail in CHANGELOG.md and #9.