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

Clean-up parsing of timezone strings #227

Merged
merged 5 commits into from Jul 12, 2019

Conversation

s0600204
Copy link
Collaborator

Notably:

  • De-duplicate the repeated instances where a string containing a timezone name is parsed into something usable.
  • To facilitate this, a new method (timezoneStringToDateTimeZone) that converts from any recognised timezone id string into a php DateTimeZone object has been added.
  • The isValidCldrTimeZoneId method now only checks for validity (like the isValidIanaTimeZoneId method).
  • Parse Windows timezones without having to set an option:
    • An isValidWindowsTimeZoneId method has been added, checking against the list of known Windows timezones.
    • The isValidTimeZoneId method has been adapted to use the above.

…ed timezone string

This reduces repeated code and logic, as well as providing a way to easily parse timezone strings into something usable.
The validation function now only checks validity.
As Windows timezones are now handled without having to set the option.
To make it clear that it caches IANA timezone ids (and not CLDR or Windows)
@u01jmg3 u01jmg3 merged commit 5683216 into u01jmg3:master Jul 12, 2019
@u01jmg3
Copy link
Owner

u01jmg3 commented Jul 12, 2019

Great work - appreciate the clean-up

@u01jmg3 u01jmg3 added this to the v2.x.x milestone Jul 12, 2019
@s0600204 s0600204 deleted the timezone_parsing branch July 13, 2019 12: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.

None yet

2 participants