-
Notifications
You must be signed in to change notification settings - Fork 54
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
Move forward by one not working #3
Comments
I will take a look! Would you mind sharing the browser you used? |
macOS Chrome, same issue |
This was replicated in both firefox 82.0 (64-bit) and chrome Version 88.0.4292.2 (Official Build) dev (64-bit) |
It happens to me too. @anchepiece idea of adding ' 00:00:00' works for me. The backward button also moves by 2 days instead of one. It happens because the seek event calculations don't handle timezone properly. // Assuming state.at is 2020-10-27 and e.detail is 1
var t = new Date(state.at);
// t is Wed Oct 26 2020 00:00:00 GMT-0400 (Eastern Daylight Time)
t.setDate(t.getDate() + e.detail); // 26 + 1 = 27
dispatch({
at: VT.formatDateId(t), // 2020-10-27
}); Clicking forward yields the original date. Clicking backward goes back 2 days. |
Ahh I should have asked for time zones. Thanks for reporting this, figuring out the cause and providing the fix! Hope it's fine now. I'll add you to the contributor file or section if that's alright :) |
I confirm it is fixed, all navigation buttons work as intended now. |
Glad its working for others too! Thanks again for sharing this project. |
Hi 👋,
Thanks for creating and open sourcing this case study.
I ran into a discrepancy between the forward and backward date movement using the left and right controls. What is seen that clicking the backward button will move the date back 2 days, while clicking forward has no effect.
The most likely reason is that the seek event listener is not applying a full day of movement once the updated date set with t.setDate(t.getDate() + e.detail) gets formatted with formatDateId.
A simple change like this in TodoStore may be enough to address this case.
var t = new Date(state.at + ' 00:00:00');
The text was updated successfully, but these errors were encountered: