Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix strftime implementations for format strings "%F" and "%j" #475

Merged
merged 2 commits into from
Jan 14, 2025

Conversation

markusmarchewa
Copy link
Contributor

Description

1.) "%F" is supposed to be same as "%Y-%m-%d" (https://www.php.net/manual/en/function.strftime.php) but was "%y-…"

2.) "%j" (day of the year) was wrong in locales with DST shifts because the interval between the start of a day during DST and the start of the year might be less than a multiple of 24 hours (the day when DST starts has just 23 hours and the day when it ends has 25 hours). Compensate by talking the timezone offsets into calculation. The test changes process.env.TZ temporarily.

Checklist

Yes,

  • I have checked to ensure there aren't other open Pull Requests for
    the same update/change?
  • I have followed the guidelines in our
    Contributing and e.g. bundled a test in the
    function header comments that fails before this PR, but passes after.

Copy link
Collaborator

@kvz kvz left a comment

Choose a reason for hiding this comment

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

Really nicely done, thanks!

@kvz kvz merged commit e5f1c1f into locutusjs:main Jan 14, 2025
3 checks passed
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