arqex / react-datetime

A lightweight but complete datetime picker react component.
1.99k stars 872 forks source link

Issue #852 Issue while selecting previous month date from FEBRUARY #854

Open ManishManda opened 1 year ago

ManishManda commented 1 year ago

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
TrekSoft commented 5 months ago

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

TrekSoft commented 5 months ago

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?