TZ offset minute has to be negated in the Western Hemisphere #46872
+13
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch fixes a bug in our AMo Time type caster that it doesn't handle minus offset in a given string correctly.
Background / Detail
When the TZ in the given string contains minus offset, both hour and minute value has to be negated, but the current code nagates hour only.
For instance in Newfoundland Time Zone (UTC−03:30), the offset part goes like "-03:30" which has to be treated as "-3 hours and -30 minutes", but it used to be calculated as "-3 hours and +30 minutes", then it used to return 1 hour advanced value than the actual.
Additional information
Parsing Time ourselves is too hard for non-professional. This bug may tell why I'm proposing to switch to Ruby's built in Time parser in #46868. And, this bug was found and reported by Time pro @nobu via https://bugs.ruby-lang.org/issues/19293#note-1 (thanks!)
Checklist
Before submitting the PR make sure the following are checked:
[Fix #issue-number]