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

Refactor date-time conversions using qtranxf_intl_strftime #1238

Merged
merged 7 commits into from
Oct 23, 2022

Conversation

herrvigg
Copy link
Collaborator

@herrvigg herrvigg commented Oct 23, 2022

The strftime function is deprecated in PHP8.1.
Generalize usage of qtranxf_intl_strftime for any PHP version. The old implementation is condemned so no point to maintain it. Eventually the strftime format may disappear but this requires more work.

Abandon support of ML date-time formats.
The use case is very unclear and looks like very old legacy code. Simplify the code by assuming the format is only for the current lang.

Bump minimal PHP version to 5.5.
Required by \DateTimeInterface. Update composer with ext-int for \IntlDateFormatter.

Deprecations -> new versions

  • qtranxf_strftime -> qtranxf_intl_strftime
  • qtranxf_convertFormat -> qtranxf_convert_to_strftime_format_using_config.
  • qtranxf_convertTimeFormat -> qtranxf_get_language_config_date_time.
  • qtranxf_convertDateFormat -> qtranxf_get_language_config_date_time.
  • qtranxf_convertDateFormatToStrftimeFormat -> qtranxf_convert_date_format_to_strftime_format.
  • deprecate $before and $after arguments in qtranxf_format_date and qtranxf_format_time

Fix missing use case when using STRFTIME format if the user format is not given. Example get_the_date(). It should use the language format. Before this patch it didn't.

The core `strftime` is deprecated in PHP8.1.
Deprecate `qtranxf_strftime`. Use `qtranxf_intl_strftime` instead.
The old implementation is condemned so no point to maintain it.
Required by `\DateTimeInterface`.
Update composer with `ext-int` for `\IntlDateFormatter`.
Replace with qtranxf_get_language_config_date_time.
Deprecate `$before` and `$after` arguments in:
- qtranxf_format_date
- qtranxf_format_time

Refactor those functions with the new one.
The use case is very unclear and looks like very old legacy code.
Simplify the code by assuming the format is for the current lang..
Replace with `qtranxf_convert_date_format_to_strftime_format`.
Deprecate the old one..
@herrvigg herrvigg changed the title Refactor date-time conversions using qxtranxf_intl_strftime Refactor date-time conversions using qtranxf_intl_strftime Oct 23, 2022
@herrvigg herrvigg added the core Core functionalities, including the admin section label Oct 23, 2022
@herrvigg
Copy link
Collaborator Author

Related to #1085 #1228 #1234.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core functionalities, including the admin section
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant