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/mobile.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'www/js/mobile.js') diff --git a/www/js/mobile.js b/www/js/mobile.js index 09c9479..53838e4 100644 --- a/www/js/mobile.js +++ b/www/js/mobile.js @@ -515,7 +515,7 @@ function get_report_params () { lon: $('#fixmystreet\\.longitude').val(), phone: $('#form_phone').val(), pc: $('#pc').val(), - time: new Date() + time: new Date().getTime() }; if ( localStorage.username && localStorage.password && localStorage.name ) { @@ -572,7 +572,7 @@ function display_saved_reports() { var item = $('
  • '); var date; if ( r[i].time ) { - var date_o = new Date( r[i].time ); + var date_o = new Date( parseInt(r[i].time, 10) ); date = date_o.getDate() + '/' + ( date_o.getMonth() + 1 ) + '/' + date_o.getFullYear(); date = date + ' ' + date_o.getHours() + ':' + date_o.getMinutes(); } else { -- cgit v1.2.3