Skip to content

Commit 8578546

Browse files
waseemahmad31iamkun
authored andcommitted
fix: Fix CustomParseFormat plugin formatting bug (#536)
fix: #533
1 parent eeb20fa commit 8578546

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/plugin/customParseFormat/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const matchUpperCaseAMPM = /[AP]M/
99
const matchLowerCaseAMPM = /[ap]m/
1010
const matchSigned = /[+-]?\d+/ // -inf - inf
1111
const matchOffset = /[+-]\d\d:?\d\d/ // +00:00 -00:00 +0000 or -0000
12-
const matchWord = /\d*[^\s\d]+/ // Word
12+
const matchWord = /\d*[^\s\d-:/.()]+/ // Word
1313

1414
let locale
1515

test/plugin/customParseFormat.test.js

+6
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ it('parse padded string', () => {
2626
expect(dayjs(input, format).valueOf()).toBe(moment(input, format).valueOf())
2727
})
2828

29+
it('parse string for MMM month format', () => {
30+
const input = '4/Mar/2019:11:16:26 +0800'
31+
const format = 'D/MMM/YYYY:H:m:s zz'
32+
expect(dayjs(input, format).valueOf()).toBe(moment(input, format).valueOf())
33+
})
34+
2935
it('parse string January (getMonth() = 0)', () => {
3036
const input = '01/01/2019'
3137
const format = 'DD/MM/YYYY'

0 commit comments

Comments
 (0)