arqex / react-datetime

A lightweight but complete datetime picker react component.
2k stars 870 forks source link

Select wrong date 31/08 v3.1.1 #804

Open NamPhan29117 opened 3 years ago

NamPhan29117 commented 3 years ago

"react-datetime": "3.1.1"

select date 2021-09-01 then set date 2021-08-31 the date input shows 2021-08-01

katesroad commented 3 years ago

I'm having the same issue for my application.

ShaiGilboa commented 2 years ago

issue persists with latest version :(

VAKHULA commented 2 years ago

the same issue for select date 2022-02-01 then set date 2022-01-31 the date input shows 2022-01-03 "react-datetime": "3.1.1"

rxviperx commented 2 years ago

Please help and fix this, no idea how to fix this my side here

the same issue for select date 2022-04-01 then set date 2022-03-31 the date input shows 2022-03-01 "react-datetime": "3.1.1"

iantbarker commented 2 years ago

I thought I was going crazy for June. Calendar is set to June 1st, open and select May 31st, date comes back as May 1st. Here is a console.log of what is returning on the onChange. Using 3.1.1 as well.

Screen Shot 2022-05-31 at 8 06 41 AM
hrhrsdn commented 2 years ago

This is because, date is set before month which does not have day 31 in the implementation. changing the set order in code worked for me. image

Macy6 commented 1 year ago

This is because, date is set before month which does not have day 31 in the implementation. changing the set order in code worked for me. image

Where to write this code to solve the issue

This code is in DateTime.js: https://github.com/arqex/react-datetime/issues/744#issuecomment-707963852

Macy6 commented 1 year ago

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

tinhtony2506 commented 1 year ago

@Macy6 Can confirm that your force is perfect <3