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

[REF] [PHP8.1] Replace usage of smarty's date_filter to ensure we don't call s… #23800

Merged
merged 1 commit into from
Jun 16, 2022

Conversation

seamuslee001
Copy link
Contributor

…trftime which is deprecated in php8.1

Overview

This aims to eliminate from CiviCRM's code calls that generate calls to strftime by replacing the date_modifier calls with crmDate which handles similar sort of thing without the deprecated function

Before

Smarty Date Modifier used in these places

After

CiviCRM's date modifier is used

ping @totten @demeritcowboy

@civibot civibot bot added the master label Jun 15, 2022
@civibot
Copy link

civibot bot commented Jun 15, 2022

(Standard links)

@@ -369,7 +369,7 @@ public static function customFormat($dateString, $format = NULL, $dateParts = NU

$hour24 = (int) substr($dateString, 11, 2);
$minute = (int) substr($dateString, 14, 2);
$second = (int) substr($dateString, 16, 2);
$second = (int) substr($dateString, 17, 2);
Copy link
Contributor

Choose a reason for hiding this comment

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

this was only just added in the rc - if it is wrong then we should change this line in the rc

Copy link
Contributor

Choose a reason for hiding this comment

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

(note the passive voice - had it been correct I could have said 'I added it' but since it seems It might be wrong.....)

Copy link
Contributor

Choose a reason for hiding this comment

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

I wouldn't have noticed in my testing since the import wouldn't hit that line but yes it seems like it should be 17.

Copy link
Contributor

Choose a reason for hiding this comment

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

You could have said 'it was not noticed' :-)

Copy link
Contributor

Choose a reason for hiding this comment

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

Hehe. Yes one could have said that.

@@ -127,7 +127,7 @@
{/if}
{else}
<div class="label">{$form.start_date.label}</div>
<div class="content">{$start_date_display|date_format}</div>
<div class="content">{$start_date_display|crmDate}</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure about this one. Without a format string these give different formats, which is probably system-dependent. On my test site I get something like Jan 2, 2021 for date_format, and January 2nd, 2021 12:13 PM for crmDate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok I have added the default format from date_format plugin to keep this the same

{if $event.end_date|date_format:"%Y%m%d" == $event.start_date|date_format:"%Y%m%d"}
{$event.end_date|date_format:"%I:%M %p"}
{if $event.end_date|crmDate:"%Y%m%d" == $event.start_date|crmDate:"%Y%m%d"}
{$event.end_date|crmDate:"%I:%M %p"}
Copy link
Contributor

Choose a reason for hiding this comment

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

This is also slightly different, e.g. 12:13 PM vs 12:13 pm. But I don't think that would be confusing, and it's unlikely people have automated scripts that are parsing this or something.

…trftime which is deprecated in php8.1

Ensure start date format is the same
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants