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: deprecated strftime with IntlDateFormatter #35

Merged
merged 6 commits into from
May 14, 2024

Conversation

rmeister
Copy link
Contributor

A little band-aid for the deprecation of strftime.

@rmeister rmeister mentioned this pull request Feb 16, 2024
@mzur
Copy link
Owner

mzur commented Feb 19, 2024

Thanks! Is this intentionally still a draft?

@rmeister
Copy link
Contributor Author

rmeister commented Feb 21, 2024

I'm not really familiar with php, so I assumed there would be things that can be improved. Also, I was rushing a little and did not check what the GitHub draft feature is actually used for.

@rmeister rmeister marked this pull request as ready for review February 21, 2024 22:10
Copy link
Owner

@mzur mzur left a comment

Choose a reason for hiding this comment

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

Thanks a lot! Do you use this already on a site somewhere (and everything works)?

I noticed that some changes replaced the old tab indentation with spaces. Could you please change the indentation back to tabs?

snippets/calendar-div.php Outdated Show resolved Hide resolved
snippets/calendar-table.php Outdated Show resolved Hide resolved
snippets/calendar-teaser.php Outdated Show resolved Hide resolved
@mzur mzur linked an issue Feb 24, 2024 that may be closed by this pull request
@rmeister
Copy link
Contributor Author

I use it on https://hog-neppendorf.de
It seems there still is an issue that could be related to timezones, as begin dates are incorrectly printed as one day before the specified day.

The date and time fields of the data structure are assumed to be stored including the respective
 timezone. Hence, when creating the Unix timestamp from the fields the timezone must be respected,
 so the IntlDateFormatter can format the string correctly.
Instead of strtotime() it is now using the DateTime constructor with a timezone
 (from date_default_timezone_get()) as argument.
Alternatively, one could store the beginTimestamp directly as DateTime(Immutable) object.
… integers.

Getters still give the Unix timestamp for backward compatibility.
The right timezone seems to be already used implicitly, so it must not be applied additionally.
@jan-heise
Copy link

Hey @mzur do you think that this PR is ready to be merged?

@mzur
Copy link
Owner

mzur commented May 1, 2024

@rmeister Does everything work for you now?

@rmeister
Copy link
Contributor Author

rmeister commented May 9, 2024

Yes, looks good so far :)

Copy link
Owner

@mzur mzur left a comment

Choose a reason for hiding this comment

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

Thanks!

@mzur mzur merged commit 56340ae into mzur:master May 14, 2024
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.

[K4] 4.0 Compatibility
3 participants