commit ad498143d38530b60b194c8849a011fe68450cb9
parent 8927bc9b49ae8a1c785cf754ed9ff955e22a1c5b
Author: Dan Stillman <dstillman@zotero.org>
Date: Sun, 9 Aug 2009 18:24:58 +0000
Addresses #900, BCE date parsing
Don't try to save year if not 1-9999
Diffstat:
1 file changed, 10 insertions(+), 0 deletions(-)
diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js
@@ -1966,6 +1966,16 @@ Zotero.Date = new function(){
var utils = new Zotero.Utilities();
var parts = strToDate(str);
+
+ // FIXME: Until we have a better BCE date solution,
+ // remove year value if not between 1 and 9999
+ if (parts.year) {
+ var year = parts.year + '';
+ if (!year.match(/^[0-9]{1,4}$/)) {
+ delete parts.year;
+ }
+ }
+
parts.month = typeof parts.month != "undefined" ? parts.month + 1 : '';
var multi = (parts.year ? utils.lpad(parts.year, '0', 4) : '0000') + '-'