On a subset of devices (this has been replicated) of which I can find no pattern fetching the time from the datebox is returning a 32 minute and 11 second timezone offset.
Sample code here:
<script type="text/javascript">
$( document ).ready(function() {
$("timeIn").datebox('open');
var test = new Date().getTimezoneOffset();
var date = new Date();
$("#timeIn").datebox('setTheDate', "07:00 PM");
$("#hello").text(new Date($("#timeIn").datebox('getTheDate').toString()));
});
</script>
<html>
<div id="hello">
</div>
<input name="timeBox" class="form-control" id="timeIn" type="text" data-role="datebox" data-options='{"mode":"timebox", "useFocus": true, "useButton": false }' __swhandlertypes="remove,focus,blur,change,datebox" readonly="readonly">
</html>
here is an example of the output on a device having the issue:
Any help would be very appreciated!
Figured it out! By default timebox returns January 1 1900 + the time. For some reason which I still haven't identified, when the year is 1900 on certain devices, it messes with the timezone offset. Appending the time to a date object with the year 2018 has fixed the issue.
Any insight to WHY this behavior occurs would be appreciated :).