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 'last day of prev month' selection #805

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

katiepeters
Copy link

@katiepeters katiepeters commented Sep 15, 2021

Description

Fix 'last day of prev month' date selection in DateTime's _updateDate method (fixes #804)

Motivation and Context

Inside DateTime's _updateDate method, setting the data-value before the month/year causes unexpected behavior when a user selects the last day of the previous month. Switching the order resolves the issue.

Checklist

[x ] I have not included any built dist files (us maintainers do that prior to a new release)
[x ] I have added tests covering my changes
[x ] All new and existing tests pass
[ ] My changes required the documentation to be updated
  [ ] I have updated the documentation accordingly
  [ ] I have updated the TypeScript 1.8 type definitions accordingly
  [ ] I have updated the TypeScript 2.0+ type definitions accordingly

Set date after month/year in _updateDate
Add tests for selecting last day of old month and first day of new month
@katiepeters katiepeters changed the title Fix 'last day of prev month' selection #804 Fix 'last day of prev month' selection Sep 15, 2021
@katiepeters
Copy link
Author

@arqex Any reason why this bug hasn't been fixed yet? I saw that this problem has existed, at least as far back as May. Hopefully this can be resolved in the near future.

@tom-mi
Copy link

tom-mi commented Oct 6, 2021

Thanks for providing this fix! (for now we'll apply it to our fork until it is merged)
I have some issues with the snapshot test you changed though, I believe the changes in the snapshot tests caused by timezone differences. On my machine (Europe/Berlin) the old version still works, c1c82ac breaks it for me.
The CI seems to run with Europe/Stockholm (https://github.com/tom-mi/react-datetime/blob/master/.travis.yml#L12)

@ShaiGilboa
Copy link

issue persists with latest version :(

@bhavinzwt
Copy link

Yes, issue persist in the latest version

@Macy6
Copy link

Macy6 commented Nov 10, 2022

The issue still persists with the latest version, any updates? :(

Thanks for providing this fix! (for now we'll apply it to our fork until it is merged) I have some issues with the snapshot test you changed though, I believe the changes in the snapshot tests caused by timezone differences. On my machine (Europe/Berlin) the old version still works, c1c82ac breaks it for me. The CI seems to run with Europe/Stockholm (https://github.com/tom-mi/react-datetime/blob/master/.travis.yml#L12)

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.

Select wrong date 31/08 v3.1.1
5 participants