Fix keeping time through tz to correctly handle being near DST boundaries #872
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 is a fix for #871
This change simplifies the process by just using
moment.tz(this.toArray(), name)
, so that it doesn't have to deal with offsets directly. I then also added logic to handle making it use the second occurrence of the time in the time zone if possible, if it was the second occurrence in the original time zone.I'm not all that certain about the
var zone = mom._z || moment.defaultZone || getZone(guess());
check. It seems to match the logic for how a moment with an unspecified time zone behaves, but I haven't been able to confirm it.