From ad498143d38530b60b194c8849a011fe68450cb9 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sun, 9 Aug 2009 18:24:58 +0000 Subject: [PATCH] Addresses #900, BCE date parsing Don't try to save year if not 1-9999 --- chrome/content/zotero/xpcom/zotero.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index 0236a9e012..d7989becc6 100644 --- 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') + '-'