Skip to content

Commit e02ae82

Browse files
committed
fix: fix ios safari YYYY-MM-DD HH:mm parse BUG
fix #254
1 parent 457c435 commit e02ae82

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

test/browser.spec.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ describe('Core APIs', function () {
2020
.format('{YYYY} MM-DDTHH:mm:ss')).toBe('{2010} 04-25T00:00:00')
2121
})
2222

23-
it('Date parse - nonstandard date string with only one digit', function () {
24-
expect(dayjs('2018-4-1 1:1:1:22').isValid())
25-
.toBe(true)
26-
expect(dayjs('2018-4-1').isValid())
27-
.toBe(true)
23+
it('Date parse - nonstandard date string', function () {
24+
expect(dayjs('2018-4-1 1:1:1:22').format('YYYY-MM-DD hh:mm:ss'))
25+
.toBe('2018-04-01 01:01:01')
26+
expect(dayjs('2018-4-1').format('YYYY-MM-DD hh:mm:ss'))
27+
.toBe('2018-04-01 12:00:00')
28+
expect(dayjs('2018-4-1 11:49').format('YYYY-MM-DD hh:mm:ss')) // fix ios bug
29+
.toBe('2018-04-01 11:49:00')
2830
})
2931
})

0 commit comments

Comments
 (0)