Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorsheep@ghostwheel <sheep@ghostwheel>2009-12-18 08:31:38 (GMT)
committer sheep@ghostwheel <sheep@ghostwheel>2009-12-18 08:31:38 (GMT)
commitcfc0b34a93dbd4e29f5f215fc80b273ee4d6ccc4 (patch)
tree465bf771e8443b42b1bbcbbf5129864452cd08c7 /examples
parent2cab9fb2d946ff06081a7265d4f15c2700a58af5 (diff)
fix the date js
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/scripts.js11
1 files changed, 2 insertions, 9 deletions
diff --git a/examples/scripts.js b/examples/scripts.js
index 1a411b4..881cd6d 100755
--- a/examples/scripts.js
+++ b/examples/scripts.js
@@ -2,20 +2,13 @@ function localize_dates() {
/* Scan whole document for UTC dates and replace them with localtime versions */
var parse_date = function (text) {
var m = /^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})Z$/.exec(text);
- var d = new Date();
- d.setUTCFullYear(+m[1]);
- d.setUTCMonth(+m[2]);
- d.setUTCDate(+m[3]);
- d.setUTCHours(+m[4]);
- d.setUTCMinutes(+m[5]);
- d.setUTCSeconds(+m[6]);
- return d;
+ return new Date(Date.UTC(+m[1], +m[2]-1, +m[3], +m[4], +m[5], +m[6]));
}
var format_date = function (d) {
var p = function(n) {return ('00'+n).slice(-2); };
var tz = d.getTimezoneOffset()/60;
if (tz>0) { tz = "+"+tz; }
- return ""+d.getFullYear()+"-"+p(d.getMonth())+"-"+p(d.getDate())+" "+p(d.getHours())+":"+p(d.getMinutes())+" GMT"+tz;
+ return ""+d.getFullYear()+"-"+p(d.getMonth()+1)+"-"+p(d.getDate())+" "+p(d.getHours())+":"+p(d.getMinutes())+" GMT"+tz;
}
var nodes = document.getElementsByTagName('abbr');
for (var i=0; i<nodes.length; ++i) {