Kasper

Datepicker headache

The jQueryui datepicker has been a pain in the ass for us the last few days. But with some research I managed to enter a date before 1970 as timestamp. These values are normally represented as negative timestamps. For yet an unknown reason the datepickers setDate function does not allow these values.

To solve this issue we simply create a new Date() from the timestamp to fill the setDate function. Now the datepicker does accept these values.

$date.datepicker('setDate', new Date(-4496400000));
									

Categories: Frontend development

Hugo » « iScout – Opening Ceremony 2.0

1 Comment

  1. The function indeed works great and resolves the timestamp issues.
    We should be cautious of the timezones which the backend systems are designed/configured to process. Nevertheless, the backend systems should handle the values correctly.

Leave a Reply

Your email address will not be published.

*

 

Copyright © 2018 Kasper

Theme by Anders NorenUp ↑