-
-
Notifications
You must be signed in to change notification settings - Fork 530
Replace remaining usages of php strftime #16749
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
base: 3.x
Are you sure you want to change the base?
Conversation
So what exactly is the plan here?
With this PR, the displayed output changes, and the name of the month is always in english. Which shouldn't be the case. |
@halftrainedharry - Good point, I was kind of "running with it" given that everything else had been changed away from |
Replace strftime with modManagerDateFormatter
Code quality fixes
Update doc blocks, ref datetime instead of strftime format
Make how formatter is instantiated consistent with other usages
Replace strftime with formatter
Replace strftime with formatter
Code style/quality fixes
Replace strftime with formatter and add backward compat support for existing TVs using strftime formatting strings (new formatter static method to convert these to their datetime equivalents)
Code style/quality fixes
Fix default format in date and update format conflict prevention between string and date output filter types
Replace strftime with formatter
Code style/quality fixes
Progress commit (some work still tbd): Backs out changes to output filters and date tv props that made them non-localized by using php datetime. Adds ability to convert strftime to Intl date.
b63c08f
to
457ab3d
Compare
Note that the latest commit reflects work-in-progress to address the need for localized date display. At this point I'm looking more for opinion on where I'm going with this, structure/stragegy-wise. I'm thinking of adding a system setting allowing for explicit adoption of The backend would be much easier for users to move to, as they'd only have to change one formatting setting ( I don't believe Extras are a factor here (?), as ones that use a date in one way or another have their own formatting settings and implementations. |
What does it do?
Removes usage of the deprecated
strftime
function, implementing the recently-addedmodManagerDateFormatter
class formatting methods in its place.Why is it needed?
PHP plans to remove
strftime
in v9.0.How to test
There were five areas where
strftime
was replaced:Note that a new static method was added to
modManagerDateFormatter
to convert existing strftime formats (e.g.,'%A, %d %B %Y'
) to their datetime equivalents (e.g.,'l, d F Y'
) for BC.That said, just play around in these areas and ensure all works as expected.
Related issue(s)/PR(s)
Resolves the issue raised in #15864. The subject of moving to the
Intl
extension and itsIntlDateFormatter
methods discussed in that same issue should probably be a separate feature proposal, which would ultimately be implemented within MODX'smodManagerDateFormatter
.