Skip to content

Commit

Permalink
fix: Fix CustomParseFormat plugin formatting bug (#536)
Browse files Browse the repository at this point in the history
fix: #533
  • Loading branch information
waseemahmad31 authored and iamkun committed Mar 18, 2019
1 parent eeb20fa commit 8578546
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/plugin/customParseFormat/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const matchUpperCaseAMPM = /[AP]M/
const matchLowerCaseAMPM = /[ap]m/
const matchSigned = /[+-]?\d+/ // -inf - inf
const matchOffset = /[+-]\d\d:?\d\d/ // +00:00 -00:00 +0000 or -0000
const matchWord = /\d*[^\s\d]+/ // Word
const matchWord = /\d*[^\s\d-:/.()]+/ // Word

let locale

Expand Down
6 changes: 6 additions & 0 deletions test/plugin/customParseFormat.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ it('parse padded string', () => {
expect(dayjs(input, format).valueOf()).toBe(moment(input, format).valueOf())
})

it('parse string for MMM month format', () => {
const input = '4/Mar/2019:11:16:26 +0800'
const format = 'D/MMM/YYYY:H:m:s zz'
expect(dayjs(input, format).valueOf()).toBe(moment(input, format).valueOf())
})

it('parse string January (getMonth() = 0)', () => {
const input = '01/01/2019'
const format = 'DD/MM/YYYY'
Expand Down

0 comments on commit 8578546

Please sign in to comment.