From 4f154fd0fdb7cd5b4f31a96359a560ed72b0e544 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Lu=CC=88deritz?= Date: Fri, 17 Sep 2021 13:11:42 +0200 Subject: [PATCH] date parsing test based on IE11 bug --- test.js | 12 ++++++++++++ tests/core.js | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/test.js b/test.js index 6d3a05b..fd98c39 100644 --- a/test.js +++ b/test.js @@ -2367,6 +2367,18 @@ describe('corner cases', function() { assert.equal(wb.Sheets.Sheet1.A10.f, "'a!b'!A1"); assert.equal(wb.Sheets.Sheet1.A11.f, "'a b'!A1"); }); + it('should parse CSV date values with preceding space', function() { + var wb = X.read( + '7, 2018-03-24', + {cellDates: false, dateNF: 'yyyy-mm-dd', type:'string'} + ); + var ws = wb.Sheets.Sheet1; + var d = X.SSF.parse_date_code(ws.B1.v); + assert.equal(d.d, 24); + assert.equal(d.m, 3); + assert.equal(d.y, 2018); + assert.equal(ws.B1.w, '2018-03-24'); + }); }); describe('encryption', function() { diff --git a/tests/core.js b/tests/core.js index 6d3a05b..fd98c39 100644 --- a/tests/core.js +++ b/tests/core.js @@ -2367,6 +2367,18 @@ describe('corner cases', function() { assert.equal(wb.Sheets.Sheet1.A10.f, "'a!b'!A1"); assert.equal(wb.Sheets.Sheet1.A11.f, "'a b'!A1"); }); + it('should parse CSV date values with preceding space', function() { + var wb = X.read( + '7, 2018-03-24', + {cellDates: false, dateNF: 'yyyy-mm-dd', type:'string'} + ); + var ws = wb.Sheets.Sheet1; + var d = X.SSF.parse_date_code(ws.B1.v); + assert.equal(d.d, 24); + assert.equal(d.m, 3); + assert.equal(d.y, 2018); + assert.equal(ws.B1.w, '2018-03-24'); + }); }); describe('encryption', function() {