Skip to content

fix(calendar): honor the Unix epoch as a reference time - #3190

Open
OskarEichler wants to merge 1 commit into
iamkun:devfrom
OskarEichler:codex/calendar-epoch
Open

fix(calendar): honor the Unix epoch as a reference time#3190
OskarEichler wants to merge 1 commit into
iamkun:devfrom
OskarEichler:codex/calendar-epoch

Conversation

@OskarEichler

Copy link
Copy Markdown

Fix

Honor numeric Unix timestamp 0 as the calendar reference. It was previously treated as an omitted reference and replaced with the current date.

dayjs.extend(calendar)
dayjs(0).calendar(0)
// UTC before: '01/01/1970'; after: 'Today at 12:00 AM'
// The result now matches dayjs(0).calendar(new Date(0)).

Compatibility

No breaking API, dependency, or runtime changes. Only the incorrect numeric-zero reference changes. Existing omitted/null/falsy fallback behavior is preserved, and calendar callbacks still receive the current time as documented—not the supplied reference. Formatting, locale selection, and category thresholds are unchanged.

Verification

  • 50 focused checks for epoch/near-epoch references across calendar categories, omitted/null/falsy references, callback scope, and callback time.
  • All 794 existing tests / 93 suites and 100% line coverage on the reviewed patch set, including this change and independent locale/minMax fixes.
  • Lint, all 40 declaration files, complete package builds, and size limit pass; the release 1.11.23 backport also passes its existing suite/builds.

No tests were added or modified. The legacy size checker required a process-local OpenSSL legacy-provider flag on Node 22; no package configuration change was made.

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