adaptui/react

Datepicker throws error when "0" is filled in

jrmyio opened this issue · 1 comments

Open https://renderlesskit-react.vercel.app/?path=/story/datepicker-range--controlled-input

Select the first date's day. Hit the "0" on the keyboard.

Cannot read properties of undefined (reading 'start')
TypeError: Cannot read properties of undefined (reading 'start')
    at useDateRangePickerState (https://renderlesskit-react.vercel.app/main.091fe988.iframe.bundle.js:1:652755)
    at App (https://renderlesskit-react.vercel.app/main.091fe988.iframe.bundle.js:1:141598)
    at Ch (https://renderlesskit-react.vercel.app/989.fe0150f1.iframe.bundle.js:2:2687598)
    at li (https://renderlesskit-react.vercel.app/989.fe0150f1.iframe.bundle.js:2:2697071)
    at ck (https://renderlesskit-react.vercel.app/989.fe0150f1.iframe.bundle.js:2:2740572)
    at bk (https://renderlesskit-react.vercel.app/989.fe0150f1.iframe.bundle.js:2:2726871)
    at ak (https://renderlesskit-react.vercel.app/989.fe0150f1.iframe.bundle.js:2:2726802)
    at Tj (https://renderlesskit-react.vercel.app/989.fe0150f1.iframe.bundle.js:2:2726671)
    at Lj (https://renderlesskit-react.vercel.app/989.fe0150f1.iframe.bundle.js:2:2723696)
    at https://renderlesskit-react.vercel.app/989.fe0150f1.iframe.bundle.js:2:2673490

Also, I am not sure if related , when I select 01 - 01 - 2020 locally using the input fields directly (using the keyboard):

01-01-2020 becomes 31-12-2019 on blur

Addiitionally, when trying to change a month like "12" to "04", typing in the first "0" decrements the year field.

Fixed in #326