From d7ee3fdee28be7760dc577bda8393938535884b1 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 28 May 2020 07:00:11 -0400 Subject: [PATCH] strToDate(): A couple additional tests --- test/tests/dateTest.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/tests/dateTest.js b/test/tests/dateTest.js index be6d1a0012..cbe969db65 100644 --- a/test/tests/dateTest.js +++ b/test/tests/dateTest.js @@ -214,6 +214,20 @@ describe("Zotero.Date", function() { assert.equal(o.year, 2019); }); + it("should parse one-digit month and four-digit year", function () { + var o = Zotero.Date.strToDate('8/2020'); + assert.equal(o.month, 7); + assert.isUndefined(o.day); + assert.equal(o.year, 2020); + }); + + it("should parse two-digit month with leading zero and four-digit year", function () { + var o = Zotero.Date.strToDate('08/2020'); + assert.equal(o.month, 7); + assert.isUndefined(o.day); + assert.equal(o.year, 2020); + }); + it("should parse string with just month number", function () { var o = Zotero.Date.strToDate('1'); assert.equal(o.month, 0);