Fix the bug that time differs by 1 hour from the selected when BST/DST clocks change #500
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 PR fixes the issue that the time calculated by the plugin was one hour more than the time selected by the user when the clock moves forward an hour and one hour less when the clock moves back for users in BST/DST regions.
This happened because to calculate the selected time, the selected hours were added to the beginning of the selected day. For example, when user selected 02:00 on the day when the clock moves forward then the calculated time was 03:00 because the beginning of the day plus 2 hours is 03:00. This is due to the fact that at 01:00 the clock moves forward an hour.
For more details see
https://en.wikipedia.org/wiki/British_Summer_Time
https://en.wikipedia.org/wiki/Daylight_saving_time
In this PR the code was changed to use the hour/minute MomentJS functions to set time:
https://momentjs.com/docs/#/get-set/hour
https://momentjs.com/docs/#/get-set/minute
Fixes #462