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
Fix broken timezone abbreviations and GMT fallback #166
Fix broken timezone abbreviations and GMT fallback #166
Conversation
@mikegreiling Thanks Mike!!! Appreciate you checking everything after the merge and fixing the issue 😄 |
@chase-manning any chance I could bother you to publish a new version with these changes? I'd really like to be able to close this bug report over at GitLab 😄 |
@mikegreiling Absolutely! I'll do that now 😄 Did you get this error when running tests?
Getting it now, tried a reclone and everything and still have it. Really need to setup a yml pipeline to run tests for PRs lol! |
Yeah I did. I believe I got around it by switching node versions. There were still a lot of local test failures due to #41, but I just focused on the single test file added in this PR and figured as long as the rest still passed in CI, all was fine 😄 |
Oh awesome! Updating node worked for me 😄 |
Thank you sir, very much appreciated! |
@mikegreiling Changed version to |
This PR aims to fix what both #104 and #165 attempted to do, this time with tests to ensure it works as expected and doesn't break in the future.
The gist is this:
The
Z
formatting option attempts to generate a nice timezone abbreviation by parsing the rendered date string, recognizing something like "Eastern Daylight Time" and changing that toEDT
. For all unrecognized timezones (pretty much everything but common North American timezones) it would parse and display theGMT+xxxx
offset from the date string instead.This, however caused a couple of issues with Australian timezones. Because Australia has defined an "Australian Eastern Daylight Time" (for instance) it would erroneously match the same regex as the American "Eastern Daylight Time" and it would render as
EST
instead ofAEST
. Adding explicit support for the"Australian "
prefix fixes this issue.The
GMT+xxxx
fallback worked prior to #165 but it was broken, probably accidentally while rebasing #104 in an attempt to get it into a merge-able state. This PR fixes the issue introduced by #165 and adds some tests to ensure it doesn't get inadvertently broken in the future./cc @chase-manning