Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I change flatpickr default timezone

Tags:

flatpickr

I am using flatpickr in order to set a date,

onChange: function(selectedDates, dateStr, instance) {
    var myDate = selectedDates[0];

First I am tracing selecteDate[0] and gives me a string

Thu Dec 20 2018 00:00:00 GMT-0500 (GMT-05:00)

Then I am tracing myDate and seems that is been converted to GMT+0000 ISO string.

2018-12-20T05:00:00.000Z

So my question is where does the flatpickr picks the GMT-0500 from? Is it possible to change it?

like image 260
Petran Avatar asked Nov 17 '22 19:11

Petran


1 Answers

Unfortunately, it doesn't seem to be possible to do that (currently). https://github.com/flatpickr/flatpickr/issues/1532

Apparently, flatpickr uses, by default, the timezone of the computer.

like image 79
GB5 Avatar answered Nov 19 '22 08:11

GB5