Try more date fixes.
authorCameron McCormack <cam@mcc.id.au>
Sat, 18 Aug 2012 18:12:58 +1000
changeset 50 19fdd6572411
parent 49 663aa82ee195
child 51 f7d16d078dd0
Try more date fixes.
publish/config.js
--- a/publish/config.js	Sat Aug 18 18:05:44 2012 +1000
+++ b/publish/config.js	Sat Aug 18 18:12:58 2012 +1000
@@ -115,7 +115,13 @@
   this.publishDirectory = attr(root, 'output', 'publish-directory');
 
   var pubDate = text(root, 'publication-date')
-  this._publicationDate = pubDate ? new Date(pubDate + 'Z') : new Date;
+  this._publicationDate = new Date;
+  if (pubDate) {
+    var dateParts = pubDate.split('-');
+    this._publicationDate.setFullYear(dateParts[0]);
+    this._publicationDate.setMonth(dateParts[1] - 1, 1);
+    this._publicationDate.setDate(dateParts[2]);
+  }
 
   var versions = child(root, 'versions');
   this.versions = {
@@ -199,13 +205,13 @@
   },
 
   get publicationYear() {
-    return this._publicationDate.getUTCFullYear();
+    return this._publicationDate.getFullYear();
   },
 
   get publicationDate() {
     var months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
     var d = this._publicationDate;
-    return (d.getUTCDate() < 10 ? '0' : '') + d.getUTCDate() + ' ' + months[d.getUTCMonth()] + ' ' + d.getUTCFullYear();
+    return (d.getDate() < 10 ? '0' : '') + d.getDate() + ' ' + months[d.getMonth()] + ' ' + d.getFullYear();
   },
 
   get thisVersion() {