fix datetime parsing in JavaScript
This commit is contained in:
parent
19ae3343cb
commit
5512d2b0e0
@ -119,10 +119,8 @@
|
|||||||
|
|
||||||
// converts date format from JSON
|
// converts date format from JSON
|
||||||
function getChartDate(d) {
|
function getChartDate(d) {
|
||||||
// get the data using javascript's date object (year, month, day, hour, minute, second)
|
|
||||||
// months in javascript start at 0, so remember to subtract 1 when specifying the month
|
|
||||||
// offset in minutes is converted to milliseconds and subtracted so that chart's x-axis is correct
|
// offset in minutes is converted to milliseconds and subtracted so that chart's x-axis is correct
|
||||||
return Date.UTC(d.substring(0,4), d.substring(5,7)-1, d.substring(8,10), d.substring(11,13), d.substring(14,16), d.substring(17,19)) - (my_offset * 60000);
|
return Date.parse(d) - (my_offset * 60000);
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -14,10 +14,8 @@
|
|||||||
|
|
||||||
// converts date format from JSON
|
// converts date format from JSON
|
||||||
function getChartDate(d) {
|
function getChartDate(d) {
|
||||||
// get the data using javascript's date object (year, month, day, hour, minute, second)
|
|
||||||
// months in javascript start at 0, so remember to subtract 1 when specifying the month
|
|
||||||
// offset in minutes is converted to milliseconds and subtracted so that chart's x-axis is correct
|
// offset in minutes is converted to milliseconds and subtracted so that chart's x-axis is correct
|
||||||
return Date.UTC(d.substring(0,4), d.substring(5,7)-1, d.substring(8,10), d.substring(11,13), d.substring(14,16), d.substring(17,19)) - (myOffset * 60000);
|
return Date.parse(d) - (myOffset * 60000);
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).on('page:load ready', function() {
|
$(document).on('page:load ready', function() {
|
||||||
|
@ -9,10 +9,8 @@
|
|||||||
|
|
||||||
// converts date format from JSON
|
// converts date format from JSON
|
||||||
function getChartDate(d) {
|
function getChartDate(d) {
|
||||||
// get the data using javascript's date object (year, month, day, hour, minute, second)
|
|
||||||
// months in javascript start at 0, so remember to subtract 1 when specifying the month
|
|
||||||
// offset in minutes is converted to milliseconds and subtracted so that chart's x-axis is correct
|
// offset in minutes is converted to milliseconds and subtracted so that chart's x-axis is correct
|
||||||
return Date.UTC(d.substring(0,4), d.substring(5,7)-1, d.substring(8,10), d.substring(11,13), d.substring(14,16), d.substring(17,19)) - (myOffset * 60000);
|
return Date.parse(d) - (myOffset * 60000);
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).on('page:load ready', function() {
|
$(document).on('page:load ready', function() {
|
||||||
|
@ -112,10 +112,8 @@
|
|||||||
|
|
||||||
// converts date format from JSON
|
// converts date format from JSON
|
||||||
function getChartDate(d) {
|
function getChartDate(d) {
|
||||||
// get the data using javascript's date object (year, month, day, hour, minute, second)
|
|
||||||
// months in javascript start at 0, so remember to subtract 1 when specifying the month
|
|
||||||
// offset in minutes is converted to milliseconds and subtracted so that chart's x-axis is correct
|
// offset in minutes is converted to milliseconds and subtracted so that chart's x-axis is correct
|
||||||
return Date.UTC(d.substring(0,4), d.substring(5,7)-1, d.substring(8,10), d.substring(11,13), d.substring(14,16), d.substring(17,19)) - (my_offset * 60000);
|
return Date.parse(d) - (my_offset * 60000);
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user