Skip to content

fix: offset() returns NaN for dates with non 4-digit years#82

Open
tk1024 wants to merge 1 commit intoformkit:mainfrom
tk1024:fix/offset-non-4-digit-year
Open

fix: offset() returns NaN for dates with non 4-digit years#82
tk1024 wants to merge 1 commit intoformkit:mainfrom
tk1024:fix/offset-non-4-digit-year

Conversation

@tk1024
Copy link
Copy Markdown

@tk1024 tk1024 commented Apr 2, 2026

  • Rewrite relativeTime() to use Date.UTC() instead of reconstructing ISO strings
  • Add era retrieval from Intl.DateTimeFormat to correctly handle BCE years
  • Use setUTCFullYear(year, month, day) to avoid leap day normalization issues

Closes #77

- Rewrite relativeTime() to use Date.UTC() instead of reconstructing ISO strings
- Add era retrieval from Intl.DateTimeFormat to correctly handle BCE years
- Use setUTCFullYear(year, month, day) to avoid leap day normalization issues

Closes formkit#77
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 2, 2026

@tk1024 is attempting to deploy a commit to the Formkit Team on Vercel.

A member of the Team first needs to authorize it.

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.

Offset bug with non 4 digit input dates

1 participant