Skip to content

Commit

Permalink
fix: update localeData plugin to add longDateFormat to global localeD…
Browse files Browse the repository at this point in the history
…ata (#1106)
  • Loading branch information
1 parent 0c62ed8 commit e3420de
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/plugin/localeData/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ export default (o, c, dayjs) => { // locale needed later
weekdaysShort: () => dayjs.weekdaysShort(),
weekdaysMin: () => dayjs.weekdaysMin(),
months: () => dayjs.months(),
monthsShort: () => dayjs.monthsShort()
monthsShort: () => dayjs.monthsShort(),
longDateFormat: format => localeObject.formats[format]
}
}

Expand Down
4 changes: 4 additions & 0 deletions test/plugin/localeData.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ it('Global localeData', () => {
expect(dayjsLocaleData.weekdays()).toEqual(momentLocaleData.weekdays())
expect(dayjsLocaleData.weekdaysShort()).toEqual(momentLocaleData.weekdaysShort())
expect(dayjsLocaleData.weekdaysMin()).toEqual(momentLocaleData.weekdaysMin())
const longDateFormats = ['LT', 'LTS', 'L', 'LL', 'LLL', 'LLLL']
longDateFormats.forEach((f) => {
expect(dayjsLocaleData.longDateFormat(f)).toEqual(momentLocaleData.longDateFormat(f))
})
})
})

Expand Down

0 comments on commit e3420de

Please sign in to comment.