mirror of
https://github.com/e107inc/e107.git
synced 2025-07-30 19:30:25 +02:00
datetimepicker() assumes the timezone to be that of the browser, which can pose problems in some situations. Now we can set a different timezone for the datepicker input and the UTC value will be automatically adjusted. eg. writeParms = array(type='datetime', 'timezone'=>'America/Los_Angeles')
This commit is contained in:
@@ -75,6 +75,20 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}};
|
||||
newValue = $("#" + ev.target.id).val();
|
||||
}
|
||||
|
||||
offset = parseInt($item.attr("data-date-timezone-offset"));
|
||||
|
||||
if(offset) // adjust UTC value to target timezone. ie. timezone other than the one of the browser.
|
||||
{
|
||||
browserOffset = ev.date.getTimezoneOffset() * 60;
|
||||
relativeOffset = browserOffset + offset;
|
||||
|
||||
console.log("Browser Offset: " + browserOffset);
|
||||
console.log('Offset: ' + offset);
|
||||
console.log('Relative Offset: ' + relativeOffset);
|
||||
|
||||
newValue = newValue - relativeOffset;
|
||||
}
|
||||
|
||||
$(newTarget).val(newValue);
|
||||
|
||||
})
|
||||
|
Reference in New Issue
Block a user