mantinedev / mantine

A fully featured React components library
https://mantine.dev
MIT License
26.92k stars 1.9k forks source link

DatePicker example is off by 1 month #3075

Closed mikesholiu closed 2 years ago

mikesholiu commented 2 years ago

Link to the page where something nasty is located

https://mantine.dev/dates/date-picker/

Exact quote of what is wrong

The DatePicker example shows:

const [value, setValue] = useState<DateRangePickerValue>([
    new Date(2021, 11, 1),
    new Date(2021, 11, 5),
  ]);

However, the UI is rendering with December 1, 2021 - December 5, 2021, which is ahead by 1 month.

Are you willing to create pull request with the fix?

Yes

rtivital commented 2 years ago

This is how dates work in JavaScript, months start at 0, 11 is December,