I am struggling to come up with a fix where when I input a date, say 2021-11-08T02:43:34.608Z
in ISO format, this inputs the next day, November 8
, while the current date in my timezone is November 7
.
I've tried using this line of code I found from stack overflow, but it does not make a difference:
const [date, setDate] = useState(new Date())
<DayPickerInput
format="YYYY/MM/DD"
onDayChange={(day) => {
setDate(new Date(day.getTime() - day.getTimezoneOffset() * 60000))
}}
/>
Basically, anytime in the evening, the ISO date displays the next day. This is obviously not what I am looking for.
Here is a helpful ISO converter I found to help make sense of this bug
Notice Check out this screenshot. While the current local time in November 7, 7:43pm, the ISO time is the following day.