From 04950a4ffe4c3e2afc9008ad02ad60707311bc67 Mon Sep 17 00:00:00 2001 From: Chase Manning Date: Fri, 4 Dec 2020 20:48:41 +1300 Subject: [PATCH 1/2] :white_check_mark: Add new L Mask Test --- test/test_mask-l_.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/test_mask-l_.js b/test/test_mask-l_.js index 60fac05..4de3991 100644 --- a/test/test_mask-l_.js +++ b/test/test_mask-l_.js @@ -5,7 +5,7 @@ describe("Mask: 'L'", function () { it("should format '2020-10-10T08:48:02.436' as '44'", function (done) { var date = new Date("2020-10-10T08:48:02.436"); var d = dateFormat(date, "L"); - assert.strictEqual(d, "44"); + assert.strictEqual(d, "43"); done(); }); @@ -24,7 +24,13 @@ describe("Mask: 'L'", function () { it("should format '2002-12-25T19:35:55.655' as '66'", function (done) { var d = dateFormat("2002-12-25T19:35:55.655", "L"); - assert.strictEqual(d, "66"); + assert.strictEqual(d, "65"); + done(); + }); + + it("should format '2126-07-23T03:15:25.999' as '99'", function (done) { + var d = dateFormat("2126-07-23T03:15:25.999", "L"); + assert.strictEqual(d, "99"); done(); }); }); From 488a0d6b359d6310287b67eddd9939528c3e83f2 Mon Sep 17 00:00:00 2001 From: Chase Manning Date: Fri, 4 Dec 2020 20:48:57 +1300 Subject: [PATCH 2/2] :bug: Fix L Mask Rounding Issue --- src/dateformat.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dateformat.js b/src/dateformat.js index 8f148a5..483d5ae 100644 --- a/src/dateformat.js +++ b/src/dateformat.js @@ -88,7 +88,7 @@ s: () => s(), ss: () => pad(s()), l: () => pad(L(), 3), - L: () => pad(Math.round(L() / 10)), + L: () => pad(Math.floor(L() / 10)), t: () => H() < 12 ? dateFormat.i18n.timeNames[0]