changeset 2438:37ff0a2f286f

Make _parse_date more predictable
author Radomir Dopieralski <sheep-devel@sheep.art.pl>
date Mon, 11 Nov 2013 21:28:06 +0100
parents ea73653dfadb
children 246837745b01
files hatta/static/scripts.js
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hatta/static/scripts.js	Mon Nov 11 21:26:01 2013 +0100
+++ b/hatta/static/scripts.js	Mon Nov 11 21:28:06 2013 +0100
@@ -5,7 +5,7 @@
         /* Parse an ISO 8601 date string. */
 
         var m = /^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})Z$/.exec(text);
-        return new Date(Date.UTC(+m[1], +m[2] - 1, +m[3], +m[4], +m[5], +m[6]));
+        return Date.UTC(+m[1], +m[2] - 1, +m[3], +m[4], +m[5], +m[6]);
     };
 
     var _pad  = function(number) {
@@ -43,7 +43,7 @@
             if (tag.className === 'date') {
                 var d = _parse_date(node.getAttribute('title'));
                 if (d) {
-                    tag.textContent = _format_date(d);
+                    tag.textContent = _format_date(new Date(d));
                 }
             }
         });