Skip to content

Commit 5c33d8e

Browse files
recoded convert_time() to be portable
1 parent 3f5a330 commit 5c33d8e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

js/tracker.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -530,8 +530,13 @@ function roundNumber(number, digits) {
530530
return rndedNum;
531531
}
532532

533+
function convert_time(text) {
534+
var b = text.split(/[^0-9]/);
535+
return Date.UTC(b[0],--b[1],b[2],b[3],b[4],b[5]);
536+
}
537+
533538
function stringToDateUTC(text) {
534-
return new Date(text.replace(" ","T") + "Z");
539+
return new Date(convert_time(text));
535540
}
536541

537542
function formatDate(date,utc) {
@@ -825,10 +830,6 @@ function updatePolyline(vehicle_index) {
825830
}
826831
}
827832

828-
function convert_time(text) {
829-
return stringToDateUTC(text).getTime();
830-
}
831-
832833
function drawAltitudeProfile(c1, c2, alt_list, alt_max) {
833834
alt_max = (alt_max < 2000) ? 2000 : alt_max;
834835

0 commit comments

Comments
 (0)