-
-
Notifications
You must be signed in to change notification settings - Fork 814
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
[REF][PHP8.1] Replace usage of the date_format modifer with crmDate t… #24008
[REF][PHP8.1] Replace usage of the date_format modifer with crmDate t… #24008
Conversation
(Standard links)
|
@@ -25,7 +25,7 @@ | |||
{/if} | |||
|
|||
<p>Your order number is #{$transaction_id}. {if !empty($line_items) && empty($is_refund)} Information about the workshops will be sent separately to each participant.{/if} | |||
Here's a summary of your transaction placed on {$transaction_date|date_format:"%D %I:%M %p %Z"}:</p> | |||
Here's a summary of your transaction placed on {$transaction_date|crmDate:"%D %I:%M %p %Z"}:</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very different.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above about %Z. Otherwise there's a minor difference now but unlikely to be a problem. Previously: "Eastern Daylight Time", now: "EDT". And am/pm vs AM/PM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@demeritcowboy ok so the lower case AM/PM might be a thing but the timezone to me looks like it as always meant to be abbreviation as per https://www.php.net/manual/en/function.strftime.php note it is capital Z
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah ok I'm not too worried about this difference. It's more that date('T') will give the wrong zone half (quarter?) the time since it is always based on "now" (because of pesky Daylight Saving).
FWIW most of these changes are in places where I intend to swap out the smarty vars for tokens. I haven't been putting up much on that work cos the open PR hasn't been getting much traction but those legacy date formatting calls will all 'naturally' disappear as I work through making the templates previewable |
f0e8969
to
a4f6c76
Compare
I have brought in my changes from the #24032 PR and also have applied some handling now for %D and %Z |
a4f6c76
to
1c18f20
Compare
@demeritcowboy now with the other PR merged does this seem better to you now? |
1c18f20
to
db7be64
Compare
CRM/Utils/Date.php
Outdated
'%s' => str_pad($second, 2, 0, STR_PAD_LEFT), | ||
'%S' => str_pad($second, 2, 0, STR_PAD_LEFT), | ||
'%Z' => date('T'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to take the date being custom-format'd into account, since otherwise it always gives the timezone corresponding to "now".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok updated to that now @demeritcowboy good pick up
db7be64
to
58b26d6
Compare
…o resolve issues with strftime Add in handling for %D and %Z pick up timezone based on date
58b26d6
to
970cdb4
Compare
…o resolve issues with strftime
Overview
This is like #23800 but for message_templates
Before
date_format modifier used triggering strftime deprecations
After
crmDate modifier used and less deprecations
ping @eileenmcnaughton @totten @demeritcowboy @colemanw