Question T621
Visible to All Users

datePicker issue

created 7 years ago

I tested the DatePicker widget with mm/dd/yy format. it works.

However if I tried it with yy-mm-dd, it always prints a day before.
For example, I picked May 2nd., prints 05/02/2018 but when I changed the format to yy-mm-dd, it prints 2018-05-01!

Have you ever tried it?

Answers

created 7 years ago

Well it was not an issue of datepicker widget. It rather is about how javascript handles the date when it is formatted as "yy-mm-dd".
https://stackoverflow.com/questions/7556591/javascript-date-object-always-one-day-off

I added formatting in the script that resolved it.

thanks,
Jason Koo

    Comments (1)

      Great!
      Thank you for sharing the solution.

      Thank you,
      Andrew
      SurveyJS Team

      created 7 years ago

      Hello,
      I have just tried and it works fine to me: https://plnkr.co/edit/NCbLVWdt9640gvZHvKcL?p=preview
      There is maybe a bug jQuery date picker, we are using it in this custom widget. We just set its properties. Please try, if jQuery date picker works in your enviroment.

      Thank you,
      Andrew