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

Fix the bug that time differs by 1 hour from the selected when BST/DST clocks change #500

Merged
merged 1 commit into from
Oct 28, 2020

Conversation

Hirurg103
Copy link
Contributor

@Hirurg103 Hirurg103 commented Oct 27, 2020

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

…T clocks change

[fix #462]

Before this commit the time calculated by the plugin was one hour more
than the time selected by the user when the clocks move forward an hour
and one hour less when the clocks move 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 clocks move 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 clocks move 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 commit 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
@monovertex
Copy link
Collaborator

Thank you for your contribution! I'll be releasing a new version shortly with your fixes.

@monovertex monovertex merged commit ef5baaf into longbill:master Oct 28, 2020
@Hirurg103
Copy link
Contributor Author

Thank you for accepting this fix @monovertex

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.

Bug with setValue: hours is 1hr less than selected
2 participants