I'm using a date/time picker with a "friendly" display for the input value which I am trying to convert to a javascript date object. When the date is selected, it comes in this format:
October 21 2013 09:00
Which I then attempt to covert to a javascript object with the following function:
function pickerDateToJavascriptObj(dateIn)
{
dateIn = dateIn.split(/[- :]/);
dateIn[0] = getMonthNumber(dateIn[0]);
outDate = new Date(dateIn[2],dateIn[0],dateIn[1],dateIn[4],dateIn[5], "00");
console.log(outDate);
return outDate;
}
I have to date pickers on my page a 'from' date and a 'to' date. When I submit the form and console.log the outDates, the dates are correctly converted to an object, however they consistently have different time zones. For the 'from' date, I get in my console:
Date {Mon Oct 21 2013 09:00:00 GMT+0100 (GMT Standard Time)}
and for the 'to' date, I am getting:
Date {Thu Oct 31 2013 09:00:00 GMT+0000 (GMT Daylight Time)}
Notice the difference between standard and daylight time of the 2 dates.
What could be causing this discrepancy?
Here are the 2 inputs:
<input type="text" placeholder="Start Date/Time" name="eventStart" id="eventStart" class="dateTimePicker" readonly="readonly">
<input type="text" placeholder="End Date/Time" name="eventEnd" id="eventEnd" class="dateTimePicker" readonly="readonly">