Skip to content

[TS] Compute Date time fields without calendar decomposition - #533

Merged
CaelmBleidd merged 2 commits into
mainfrom
caelmbleidd/compact-date-time-getters
Oct 16, 2026
Merged

CaelmBleidd merged 2 commits into
mainfrom
caelmbleidd/compact-date-time-getters

Conversation

@CaelmBleidd

Copy link
Copy Markdown
Member

Date time-component getters rebuilt the complete calendar and allocated DateParts objects for values that only depend on the timestamp within a second/minute/hour/day or on the weekday. Compute getDay/getHours/getMinutes/getSeconds/getMilliseconds directly with the existing remainder/floor arithmetic. UTC wrappers keep calling these shared implementations; no supported input bound or existing UTC-for-local environment assumption changes.

For the identical ordinary TypeScript program reading five UTC fields at -1 ms, interpreter instructions decrease from 1,836 to 338, with calendar instructions decreasing from 745 to 0. This is a narrow execution-cost comparison, not a 200-class coverage claim.

Validation: 25 focused Date source-model tests passed, including TimeClip min/max, negative/fractional input, invalid Date and Node replay of the original source. The native comparison script now checks 10,139 timestamp cases (seeded complete clipped range plus unit boundaries, signed zero, NaN and infinities) against JavaScript UTC getters; all pass. The same boundary semantics regression passes unchanged main, while the calendar-traversal regression fails there as intended. Strict usvm-ts detektMain/detektTest passed. Full suites left to CI.

@CaelmBleidd
CaelmBleidd merged commit 61d6b9d into main Oct 16, 2026
6 checks passed
@CaelmBleidd
CaelmBleidd deleted the caelmbleidd/compact-date-time-getters branch October 16, 2026 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant