Skip to content

fix: pad full years to four digits - #15

Open
xiehuanyi wants to merge 1 commit into
lukeed:masterfrom
xiehuanyi:fix-full-year-padding-20261008
Open

xiehuanyi wants to merge 1 commit into
lukeed:masterfrom
xiehuanyi:fix-full-year-padding-20261008

Conversation

@xiehuanyi

Copy link
Copy Markdown

{YYYY} formats years 0 through 9 with three digits: year 1 becomes 001 instead of 0001. The built-in formatter prepends only two zeros before slicing to the token width.

Use three leading zeros, enough for the widest built-in token. Existing shorter tokens still take their required suffix width, and modern four-digit years retain their output.

Validation:

  • Three new assertions fail against the original code (27/30 assertions pass).
  • npm test passes all 30 assertions on local Node 22 and every CI runtime: Node 6, 12 and 18.
  • Regression covers years 0, 1, 9 and the boundaries to two-, three- and four-digit years.
  • git diff --check passes.

AI assistance: Codex assisted with discovery, implementation and validation. Tests cover nonnegative calendar years; custom formatters continue to control their own padding.

Copilot AI balanced review requested due to automatic review settings October 8, 2026 11:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

2 participants