diff --git a/chrome/content/zotero/bindings/itembox.xml b/chrome/content/zotero/bindings/itembox.xml index 11dd51c123..99e18ca13c 100644 --- a/chrome/content/zotero/bindings/itembox.xml +++ b/chrome/content/zotero/bindings/itembox.xml @@ -1854,7 +1854,7 @@ // Fields else { - // Access date needs to be parsed and converted to UTC + // Access date needs to be parsed and converted to UTC SQL date if (value != '') { switch (fieldName) { case 'accessDate': diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js index 67fd8b7f03..e8bf7c232d 100644 --- a/chrome/content/zotero/xpcom/data/item.js +++ b/chrome/content/zotero/xpcom/data/item.js @@ -805,7 +805,7 @@ Zotero.Item.prototype.setField = function(field, value, loadIn) { else if (fieldID == Zotero.ItemFields.getID('accessDate')) { if (value && value != 'CURRENT_TIMESTAMP') { // Accept ISO dates - if (Zotero.Date.isISODate(value)) { + if (Zotero.Date.isISODate(value) && !Zotero.Date.isSQLDate(value)) { let d = Zotero.Date.isoToDate(value); value = Zotero.Date.dateToSQL(d, true); } diff --git a/test/tests/itemTest.js b/test/tests/itemTest.js index 9d3ee0d549..5b5b31ec24 100644 --- a/test/tests/itemTest.js +++ b/test/tests/itemTest.js @@ -207,6 +207,13 @@ describe("Zotero.Item", function () { } }) + it("should accept SQL accessDate without time", function* () { + var item = createUnsavedDataObject('item'); + var date = "2017-04-05"; + item.setField("accessDate", date); + assert.strictEqual(item.getField('accessDate'), date); + }); + it("should ignore unknown accessDate values", function* () { var fields = { accessDate: "foo"