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

[10.x] Added parameters to timezone validation rule #47171

Merged
merged 5 commits into from
May 23, 2023

Conversation

Artyomushko
Copy link
Contributor

The problem that I've got

IANA has officially changed the Ukraine's timezone from Ukraine/Kiev to Ukraine/Kyiv in 2022b version of tzdata. But some systems still use the old versions of tzdata. And timezone validations are started to fail.

Ways to resolve

To resolve that problem in my project I've created custom validation rule for timezones that is actually a copy of current timezone validation but with a parameter DateTimeZone::ALL_WITH_BC that returns all timezones list with a Backward Compatibility. So all old timezone names will be accepted with this parameter.

What I have changed in the PR

I have modified current timezone validation to accept parameters that could be passed to timezone_identifiers_list method. It could be useful also for those projects that are designed to work only in specific country. So developers can accept the timezones from the only country.

'timezone' // works as before
'timezone:Africa' // accepts only Africans timezones
'timezone:All' // works the same as without any parameters
'timezone:All_with_BC' // accepts timezones with Backward Compatibility (Europe/Kiev will be accepted)
'timezone:Per_country,US' // accepts only US timezones

@driesvints driesvints marked this pull request as draft May 23, 2023 07:55
@Artyomushko Artyomushko marked this pull request as ready for review May 23, 2023 08:37
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.

4 participants