From 7f45a2fc19e5e225b2cc9e6acbb515c9f6efe2ac Mon Sep 17 00:00:00 2001 From: Mark Longair Date: Tue, 20 Nov 2012 18:07:37 +0000 Subject: Store the time as milliseconds since the epoch rather than ISO 8601 Annoyingly, many variants of Javascript can't parse datetimes in the ISO 8601 variant that is output by Date's toString method. Instead, store the date and time as milliseconds since the Unix epoch, which is more widely supported. --- www/js/report.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'www/js/report.js') diff --git a/www/js/report.js b/www/js/report.js index a14f38b..4a79568 100644 --- a/www/js/report.js +++ b/www/js/report.js @@ -32,7 +32,7 @@ function Report(spec) { var t; if ( typeof props.time === 'String' ) { - t = new Date( props.time ); + t = new Date( parseInt(props.time, 10) ); } else { t = props.time; } @@ -47,7 +47,7 @@ function Report(spec) { if ( ! reports ) { reports = []; } - props.time = new Date(); + props.time = new Date().getTime(); if ( my_id != -1 ) { reports[my_id] = props; } else { -- cgit v1.2.3