1
0
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:
Cameron
2018-05-25 19:00:55 -07:00
parent d023cfc63c
commit bab26e7762
2 changed files with 28 additions and 2 deletions

View File

@@ -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);
})