From bb15336fdb23ec3441ec9cceb8ff9ab0a7019acc Mon Sep 17 00:00:00 2001 From: Aurimas Vinckevicius Date: Tue, 4 Aug 2015 14:19:39 -0500 Subject: [PATCH] Fix season export in CSL JSON --- chrome/content/zotero/xpcom/date.js | 4 +++- chrome/content/zotero/xpcom/utilities.js | 2 +- test/tests/data/citeProcJSExport.js | 3 +-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/chrome/content/zotero/xpcom/date.js b/chrome/content/zotero/xpcom/date.js index c41b5eec5..d34c326a3 100644 --- a/chrome/content/zotero/xpcom/date.js +++ b/chrome/content/zotero/xpcom/date.js @@ -330,6 +330,8 @@ Zotero.Date = new function(){ } if(date.month) date.month--; // subtract one for JS style + else delete date.month; + Zotero.debug("DATE: retrieved with algorithms: "+JSON.stringify(date)); parts.push( @@ -369,7 +371,7 @@ Zotero.Date = new function(){ } // MONTH - if(!date.month) { + if(date.month === undefined) { // compile month regular expression var months = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec']; diff --git a/chrome/content/zotero/xpcom/utilities.js b/chrome/content/zotero/xpcom/utilities.js index ef161a193..e24ece3a4 100644 --- a/chrome/content/zotero/xpcom/utilities.js +++ b/chrome/content/zotero/xpcom/utilities.js @@ -1611,7 +1611,7 @@ Zotero.Utilities = { cslItem[variable] = {"date-parts":[dateParts]}; // if no month, use season as month - if(dateObj.part && !dateObj.month) { + if(dateObj.part && dateObj.month === undefined) { cslItem[variable].season = dateObj.part; } } else { diff --git a/test/tests/data/citeProcJSExport.js b/test/tests/data/citeProcJSExport.js index 3678e9909..67cb3f87f 100644 --- a/test/tests/data/citeProcJSExport.js +++ b/test/tests/data/citeProcJSExport.js @@ -1347,8 +1347,7 @@ 1, 2 ] - ], - "season": "2000-01-02" + ] }, "title": "Title", "type": "patent"