react-datetime icon indicating copy to clipboard operation
react-datetime copied to clipboard

Issue #852 Issue while selecting previous month date from FEBRUARY

Open ManishManda opened this issue 2 years ago • 3 comments

if we select previous month date from current month, unexpected date is being displayed

Description

According to moment documentation : if you chain multiple actions to construct a date, you should start from a year, then a month, then a day etc. Otherwise you may get unexpected results, like when day=31 and current month has only 30 days (the same applies to native JavaScript Date manipulation), the returned date will be the 30th of the current month (see month for more details).

link for reference: https://momentjs.com/docs/#/get-set/date/

i just changed the order of setting moment object date on update of a date by user

Motivation and Context

this change fixes the open issue https://github.com/arqex/react-datetime/issues/852

Checklist

[ ] I have not included any built dist files (us maintainers do that prior to a new release)
[ ] I have added tests covering my changes
[ ] 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

ManishManda avatar Feb 13 '23 09:02 ManishManda

Any reason this PR can't be merged? This is a pretty significant bug in the component.

TrekSoft avatar Feb 07 '24 20:02 TrekSoft

Actually I see the repo here hasn't been maintained in more than a year! 😳

Has anyone created a fork with this fix merged in?

TrekSoft avatar Feb 07 '24 21:02 TrekSoft

I fork the repository and fix this issue. Try https://www.npmjs.com/package/@iftek/react-datetime

yuan9090 avatar Jul 30 '24 10:07 yuan9090