Skip to content

v0.6.0

Choose a tag to compare

@leemr leemr released this 10 Aug 03:11
· 26 commits to master since this release

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 size in 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 plus day() 25,269 to 19,349, −23%.
  • daymath no longer reads globalThis.Temporal at all. The selection block 0.5.0 added is deleted. fns picks 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 what temporal-polyfill/full failed 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 answer 2569 on Node 26 and 2026 on 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

  • differenceInDays no longer uses the fns diffDays convenience. PlainDate's minimum is -271821-04-19, one day below PlainDateTime's, and diffDays converts to a PlainDateTime and inherits the narrower limit, so it refused that one operand. diff with largestUnit: '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.js is unedited, which is the point: had a test needed changing, the behaviour would have changed.

Housekeeping

  • SECURITY.md now 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.