Kalendae icon indicating copy to clipboard operation
Kalendae copied to clipboard

After Selecting A Date, Restoring Focus On Field Causes Year To Be 0000

Open wisam22 opened this issue 8 years ago • 2 comments

Love the library, very convenient solution to a common problem. However, I keep encountering the issue where after selecting a date, trying to reopen the date picker to change the date causes the year to break and always show as "0000".

wisam22 avatar Apr 26 '17 07:04 wisam22

Turns out this issue was specifically happening when I included a comma in my "format" parameter. I've decided to use a different format for the time being. I was using: MMM DD, YYYY

wisam22 avatar May 05 '17 03:05 wisam22

Solve problem when we change a value of parseSplitDelimiter option of the plugin with ' - ' (Exactly Same Space Comma Space). There is an issue with regex. When we try to set Mode as range & Format as MMM DD, YYYY (especially having comma) then split 2 dates string with 4 dates Ex Consider selected dates are Apr 1, 2017 - May 19, 2017. when try to reopen calendar then split string with a regex /,\s*|\s+-\s+/ (that is parseSplitDelimiter option) then we get array [ "Apr 1" , "2017" , "May 19" , "2017" ]

there are 4 dates, generate because of the wrong regex. like, [ Sat Apr 01 0 12:00:00 GMT+0530 (IST), Fri Jan 20 17 12:00:00 GMT+0530 (IST), Fri May 19 0 12:00:00 GMT+0530 (IST),
Fri Jan 20 17 12:00:00 GMT+0530 (IST) ]

that's why shows Apr & May month with 0000 years. When we change parseSplitDelimiter option with ' - ' String split with correct two dates. [ "Apr 1, 2017" , "May 19, 2017" ] then generate only two correct dates. like, [ Sat Apr 01 2017 12:00:00 GMT+0530 (IST), Fri May 19 2017 12:00:00 GMT+0530 (IST) ]

This is a temporary solution, need to find correct regex.

Ni03 avatar May 19 '17 07:05 Ni03