From e02ae829db6105ca9b4be6504bbe3210f02c6fab Mon Sep 17 00:00:00 2001 From: iamkun Date: Tue, 5 Feb 2019 00:12:44 +0800 Subject: [PATCH] fix: fix ios safari YYYY-MM-DD HH:mm parse BUG fix #254 --- test/browser.spec.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/test/browser.spec.js b/test/browser.spec.js index 2abd659ff..4a0f4e547 100644 --- a/test/browser.spec.js +++ b/test/browser.spec.js @@ -20,10 +20,12 @@ describe('Core APIs', function () { .format('{YYYY} MM-DDTHH:mm:ss')).toBe('{2010} 04-25T00:00:00') }) - it('Date parse - nonstandard date string with only one digit', function () { - expect(dayjs('2018-4-1 1:1:1:22').isValid()) - .toBe(true) - expect(dayjs('2018-4-1').isValid()) - .toBe(true) + it('Date parse - nonstandard date string', function () { + expect(dayjs('2018-4-1 1:1:1:22').format('YYYY-MM-DD hh:mm:ss')) + .toBe('2018-04-01 01:01:01') + expect(dayjs('2018-4-1').format('YYYY-MM-DD hh:mm:ss')) + .toBe('2018-04-01 12:00:00') + expect(dayjs('2018-4-1 11:49').format('YYYY-MM-DD hh:mm:ss')) // fix ios bug + .toBe('2018-04-01 11:49:00') }) })