duetds/date-picker

Example in date8 has outdated sample script and regex bug

mjeson opened this issue · 0 comments

The example for "Changing first day of week and date format" in live demo has id=date8. This date8 example has two issues:

  1. Documented script is different from real live demo script.
  2. The regex mentioned in both scripts have a regex issue below.

Steps to reproduce the behavior:

  1. Adapt the live demo script
  2. Sometimes, when directly modify the value without datepicker, say "2/9/2021". the value automatically changed to "9/2/2021".

Solution:
When adapting the script, I had to change this line:
return createDate(matches[3], matches[2], matches[1])
to this line:
return createDate(matches[3], matches[1], matches[2])

Per DATE_FORMAT regex, 1 is month, 2, is day, and 3 is year. The original sample script calls createDate(year,day,month). It should be (year,month,date). This is the bug.

Desktop
OS: Windows 10
Browser: Chrome

Desktop
OS: Mac
Browser: Safari