From 457511eaf111816c4071e5a8708c5f9f1498c5b9 Mon Sep 17 00:00:00 2001 From: Jukka Raimovaara Date: Thu, 1 Oct 2020 12:33:04 +0300 Subject: [PATCH 01/10] fix lowercase in LocaleData.longDateFormat() --- src/plugin/localeData/index.js | 4 +++- test/plugin/localeData.test.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugin/localeData/index.js b/src/plugin/localeData/index.js index 71ded86de..3263e4c65 100644 --- a/src/plugin/localeData/index.js +++ b/src/plugin/localeData/index.js @@ -12,6 +12,7 @@ export default (o, c, dayjs) => { // locale needed later } const getDayjsLocaleObject = () => dayjs.Ls[dayjs.locale()] const localeData = function () { + const t = format => format.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (_, a, b) => a || b.slice(1)) return { months: instance => (instance ? instance.format('MMMM') : getShort(this, 'months')), @@ -23,7 +24,8 @@ export default (o, c, dayjs) => { // locale needed later (instance ? instance.format('dd') : getShort(this, 'weekdaysMin', 'weekdays', 2)), weekdaysShort: instance => (instance ? instance.format('ddd') : getShort(this, 'weekdaysShort', 'weekdays', 3)), - longDateFormat: format => this.$locale().formats[format] + longDateFormat: format => + this.$locale().formats[format] || t(this.$locale().formats[format.toUpperCase()]) } } proto.localeData = function () { diff --git a/test/plugin/localeData.test.js b/test/plugin/localeData.test.js index 109d4780d..db70564c8 100644 --- a/test/plugin/localeData.test.js +++ b/test/plugin/localeData.test.js @@ -38,7 +38,7 @@ describe('Instance localeData', () => { expect(dayjsLocaleData.weekdaysMin()).toEqual(momentLocaleData.weekdaysMin()) expect(dayjsLocaleData.weekdaysShort(d)).toBe(momentLocaleData.weekdaysShort(m)) expect(dayjsLocaleData.weekdaysShort()).toEqual(momentLocaleData.weekdaysShort()) - const longDateFormats = ['LT', 'LTS', 'L', 'LL', 'LLL', 'LLLL'] + const longDateFormats = ['LT', 'LTS', 'L', 'LL', 'LLL', 'LLLL', 'l', 'll', 'lll', 'llll'] longDateFormats.forEach((f) => { expect(dayjsLocaleData.longDateFormat(f)).toEqual(momentLocaleData.longDateFormat(f)) }) From 1840b6c6b57565a6f46c320a258a651215da1c3a Mon Sep 17 00:00:00 2001 From: iamkun Date: Fri, 2 Oct 2020 01:30:37 +0300 Subject: [PATCH 02/10] fix: fix objectSupport plugin bug in utc fix #1105 --- src/plugin/objectSupport/index.js | 10 +++++----- test/plugin/objectSupport.test.js | 11 ++++++++--- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/plugin/objectSupport/index.js b/src/plugin/objectSupport/index.js index 6d161b8de..33b5a62da 100644 --- a/src/plugin/objectSupport/index.js +++ b/src/plugin/objectSupport/index.js @@ -1,4 +1,4 @@ -export default (o, c) => { +export default (o, c, dayjs) => { const proto = c.prototype const isObject = obj => !(obj instanceof Date) && !(obj instanceof Array) && obj instanceof Object const prettyUnit = (u) => { @@ -9,13 +9,13 @@ export default (o, c) => { const { date, utc } = cfg const $d = {} if (isObject(date)) { - const now = new Date() + const now = utc ? dayjs.utc() : dayjs() Object.keys(date).forEach((k) => { $d[prettyUnit(k)] = date[k] }) - const d = $d.day || ((!$d.year && !($d.month >= 0)) ? now.getDate() : 1) - const y = $d.year || now.getFullYear() - const M = $d.month >= 0 ? $d.month : ((!$d.year && !$d.day) ? now.getMonth() : 0)// eslint-disable-line no-nested-ternary,max-len + const d = $d.day || ((!$d.year && !($d.month >= 0)) ? now.date() : 1) + const y = $d.year || now.year() + const M = $d.month >= 0 ? $d.month : ((!$d.year && !$d.day) ? now.month() : 0)// eslint-disable-line no-nested-ternary,max-len const h = $d.hour || 0 const m = $d.minute || 0 const s = $d.second || 0 diff --git a/test/plugin/objectSupport.test.js b/test/plugin/objectSupport.test.js index 476b97f4c..392bdbf7c 100755 --- a/test/plugin/objectSupport.test.js +++ b/test/plugin/objectSupport.test.js @@ -21,6 +21,9 @@ const now = new Date() const currentYear = now.getFullYear() const currentMonth = utils.s(now.getMonth() + 1, 2, '0') const currentDate = utils.s(now.getDate(), 2, '0') +const currentUTCYear = now.getUTCFullYear() +const currentUTCMonth = utils.s(now.getUTCMonth() + 1, 2, '0') +const currentUTCDate = utils.s(now.getUTCDate(), 2, '0') const fmt = 'YYYY-MM-DD HH:mm:ss.SSS' const tests = [ [{ year: 2010 }, '2010-01-01 00:00:00.000'], @@ -31,7 +34,8 @@ const tests = [ { hour: 15, minute: 25, second: 50, millisecond: 125 }, - `${currentYear}-${currentMonth}-${currentDate} 15:25:50.125`], + `${currentYear}-${currentMonth}-${currentDate} 15:25:50.125`, + `${currentUTCYear}-${currentUTCMonth}-${currentUTCDate} 15:25:50.125`], [ { year: 2010, month: 1, day: 12, hours: 1 @@ -119,8 +123,9 @@ it('Constructor from Object', () => { it('Constructor from Object UTC', () => { for (let i = 0; i < tests.length; i += 1) { - expect(dayjs.utc(tests[i][0]).format(fmt)).toBe(tests[i][1]) - expect(moment.utc(tests[i][0]).format(fmt)).toBe(tests[i][1]) + const result = tests[i][2] || tests[i][1] + expect(dayjs.utc(tests[i][0]).format(fmt)).toBe(result) + expect(moment.utc(tests[i][0]).format(fmt)).toBe(result) } }) it('Set from Object', () => { From a86857d4ebeb38ace062b6d1032fc4866685d485 Mon Sep 17 00:00:00 2001 From: Jukka Raimovaara Date: Fri, 2 Oct 2020 10:42:11 +0300 Subject: [PATCH 03/10] export t to localeData from localizedFormat --- src/plugin/localeData/index.js | 3 ++- src/plugin/localizedFormat/index.js | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plugin/localeData/index.js b/src/plugin/localeData/index.js index 3263e4c65..cdc0185c8 100644 --- a/src/plugin/localeData/index.js +++ b/src/plugin/localeData/index.js @@ -1,3 +1,5 @@ +import { t } from '../localizedFormat' + export default (o, c, dayjs) => { // locale needed later const proto = c.prototype const getLocalePart = part => (part && (part.indexOf ? part : part.s)) @@ -12,7 +14,6 @@ export default (o, c, dayjs) => { // locale needed later } const getDayjsLocaleObject = () => dayjs.Ls[dayjs.locale()] const localeData = function () { - const t = format => format.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (_, a, b) => a || b.slice(1)) return { months: instance => (instance ? instance.format('MMMM') : getShort(this, 'months')), diff --git a/src/plugin/localizedFormat/index.js b/src/plugin/localizedFormat/index.js index b72e635b0..b56d22527 100644 --- a/src/plugin/localizedFormat/index.js +++ b/src/plugin/localizedFormat/index.js @@ -1,5 +1,8 @@ import { FORMAT_DEFAULT } from '../../constant' +export const t = format => + format.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (_, a, b) => a || b.slice(1)) + export default (o, c, d) => { const proto = c.prototype const oldFormat = proto.format @@ -12,7 +15,6 @@ export default (o, c, d) => { LLLL: 'dddd, MMMM D, YYYY h:mm A' } d.en.formats = englishFormats - const t = format => format.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (_, a, b) => a || b.slice(1)) proto.format = function (formatStr = FORMAT_DEFAULT) { const { formats = {} } = this.$locale() const result = formatStr.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, (_, a, b) => { From 275787bb44dfd1ef9f541ca8437cd9714f856aea Mon Sep 17 00:00:00 2001 From: Jukka Raimovaara Date: Fri, 2 Oct 2020 11:40:13 +0300 Subject: [PATCH 04/10] add lowercase localizedFormat to glocal localeData --- src/plugin/localeData/index.js | 3 ++- test/plugin/localeData.test.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugin/localeData/index.js b/src/plugin/localeData/index.js index e703d8e99..0b80f49e0 100644 --- a/src/plugin/localeData/index.js +++ b/src/plugin/localeData/index.js @@ -42,7 +42,8 @@ export default (o, c, dayjs) => { // locale needed later weekdaysMin: () => dayjs.weekdaysMin(), months: () => dayjs.months(), monthsShort: () => dayjs.monthsShort(), - longDateFormat: format => localeObject.formats[format] + longDateFormat: format => + localeObject.formats[format] || t(localeObject.formats[format.toUpperCase()]) } } diff --git a/test/plugin/localeData.test.js b/test/plugin/localeData.test.js index 8ed2f193e..829856406 100644 --- a/test/plugin/localeData.test.js +++ b/test/plugin/localeData.test.js @@ -61,7 +61,7 @@ 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'] + const longDateFormats = ['LT', 'LTS', 'L', 'LL', 'LLL', 'LLLL', 'l', 'll', 'lll', 'llll'] longDateFormats.forEach((f) => { expect(dayjsLocaleData.longDateFormat(f)).toEqual(momentLocaleData.longDateFormat(f)) }) From 7ef43c186708a0f1d2652d1df79db3e03b058fbb Mon Sep 17 00:00:00 2001 From: Jukka Raimovaara Date: Thu, 1 Oct 2020 12:33:04 +0300 Subject: [PATCH 05/10] fix lowercase in LocaleData.longDateFormat() --- src/plugin/localeData/index.js | 4 +++- test/plugin/localeData.test.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugin/localeData/index.js b/src/plugin/localeData/index.js index b753c3d67..2c86139d5 100644 --- a/src/plugin/localeData/index.js +++ b/src/plugin/localeData/index.js @@ -12,6 +12,7 @@ export default (o, c, dayjs) => { // locale needed later } const getDayjsLocaleObject = () => dayjs.Ls[dayjs.locale()] const localeData = function () { + const t = format => format.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (_, a, b) => a || b.slice(1)) return { months: instance => (instance ? instance.format('MMMM') : getShort(this, 'months')), @@ -23,7 +24,8 @@ export default (o, c, dayjs) => { // locale needed later (instance ? instance.format('dd') : getShort(this, 'weekdaysMin', 'weekdays', 2)), weekdaysShort: instance => (instance ? instance.format('ddd') : getShort(this, 'weekdaysShort', 'weekdays', 3)), - longDateFormat: format => this.$locale().formats[format] + longDateFormat: format => + this.$locale().formats[format] || t(this.$locale().formats[format.toUpperCase()]) } } proto.localeData = function () { diff --git a/test/plugin/localeData.test.js b/test/plugin/localeData.test.js index a2e017e90..8ed2f193e 100644 --- a/test/plugin/localeData.test.js +++ b/test/plugin/localeData.test.js @@ -38,7 +38,7 @@ describe('Instance localeData', () => { expect(dayjsLocaleData.weekdaysMin()).toEqual(momentLocaleData.weekdaysMin()) expect(dayjsLocaleData.weekdaysShort(d)).toBe(momentLocaleData.weekdaysShort(m)) expect(dayjsLocaleData.weekdaysShort()).toEqual(momentLocaleData.weekdaysShort()) - const longDateFormats = ['LT', 'LTS', 'L', 'LL', 'LLL', 'LLLL'] + const longDateFormats = ['LT', 'LTS', 'L', 'LL', 'LLL', 'LLLL', 'l', 'll', 'lll', 'llll'] longDateFormats.forEach((f) => { expect(dayjsLocaleData.longDateFormat(f)).toEqual(momentLocaleData.longDateFormat(f)) }) From 3ad5c5e4a1b9adbfe79d9c0dfc8fa70ab7880777 Mon Sep 17 00:00:00 2001 From: Jukka Raimovaara Date: Fri, 2 Oct 2020 10:42:11 +0300 Subject: [PATCH 06/10] export t to localeData from localizedFormat --- src/plugin/localeData/index.js | 3 ++- src/plugin/localizedFormat/index.js | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plugin/localeData/index.js b/src/plugin/localeData/index.js index 2c86139d5..e703d8e99 100644 --- a/src/plugin/localeData/index.js +++ b/src/plugin/localeData/index.js @@ -1,3 +1,5 @@ +import { t } from '../localizedFormat' + export default (o, c, dayjs) => { // locale needed later const proto = c.prototype const getLocalePart = part => (part && (part.indexOf ? part : part.s)) @@ -12,7 +14,6 @@ export default (o, c, dayjs) => { // locale needed later } const getDayjsLocaleObject = () => dayjs.Ls[dayjs.locale()] const localeData = function () { - const t = format => format.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (_, a, b) => a || b.slice(1)) return { months: instance => (instance ? instance.format('MMMM') : getShort(this, 'months')), diff --git a/src/plugin/localizedFormat/index.js b/src/plugin/localizedFormat/index.js index b72e635b0..b56d22527 100644 --- a/src/plugin/localizedFormat/index.js +++ b/src/plugin/localizedFormat/index.js @@ -1,5 +1,8 @@ import { FORMAT_DEFAULT } from '../../constant' +export const t = format => + format.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (_, a, b) => a || b.slice(1)) + export default (o, c, d) => { const proto = c.prototype const oldFormat = proto.format @@ -12,7 +15,6 @@ export default (o, c, d) => { LLLL: 'dddd, MMMM D, YYYY h:mm A' } d.en.formats = englishFormats - const t = format => format.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (_, a, b) => a || b.slice(1)) proto.format = function (formatStr = FORMAT_DEFAULT) { const { formats = {} } = this.$locale() const result = formatStr.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, (_, a, b) => { From 4f3a8b51f9b0edd0db87d388fd9bdf3c63daf7b5 Mon Sep 17 00:00:00 2001 From: Jukka Raimovaara Date: Fri, 2 Oct 2020 11:40:13 +0300 Subject: [PATCH 07/10] add lowercase localizedFormat to glocal localeData --- src/plugin/localeData/index.js | 3 ++- test/plugin/localeData.test.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugin/localeData/index.js b/src/plugin/localeData/index.js index e703d8e99..0b80f49e0 100644 --- a/src/plugin/localeData/index.js +++ b/src/plugin/localeData/index.js @@ -42,7 +42,8 @@ export default (o, c, dayjs) => { // locale needed later weekdaysMin: () => dayjs.weekdaysMin(), months: () => dayjs.months(), monthsShort: () => dayjs.monthsShort(), - longDateFormat: format => localeObject.formats[format] + longDateFormat: format => + localeObject.formats[format] || t(localeObject.formats[format.toUpperCase()]) } } diff --git a/test/plugin/localeData.test.js b/test/plugin/localeData.test.js index 8ed2f193e..829856406 100644 --- a/test/plugin/localeData.test.js +++ b/test/plugin/localeData.test.js @@ -61,7 +61,7 @@ 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'] + const longDateFormats = ['LT', 'LTS', 'L', 'LL', 'LLL', 'LLLL', 'l', 'll', 'lll', 'llll'] longDateFormats.forEach((f) => { expect(dayjsLocaleData.longDateFormat(f)).toEqual(momentLocaleData.longDateFormat(f)) }) From c06f158ba0c29927d4e70e9fc81e8f906ff8e46d Mon Sep 17 00:00:00 2001 From: Jukka Raimovaara Date: Fri, 2 Oct 2020 12:18:53 +0300 Subject: [PATCH 08/10] Revert "fix: fix objectSupport plugin bug in utc" This reverts commit 1840b6c6b57565a6f46c320a258a651215da1c3a. --- src/plugin/objectSupport/index.js | 10 +++++----- test/plugin/objectSupport.test.js | 11 +++-------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/plugin/objectSupport/index.js b/src/plugin/objectSupport/index.js index 33b5a62da..6d161b8de 100644 --- a/src/plugin/objectSupport/index.js +++ b/src/plugin/objectSupport/index.js @@ -1,4 +1,4 @@ -export default (o, c, dayjs) => { +export default (o, c) => { const proto = c.prototype const isObject = obj => !(obj instanceof Date) && !(obj instanceof Array) && obj instanceof Object const prettyUnit = (u) => { @@ -9,13 +9,13 @@ export default (o, c, dayjs) => { const { date, utc } = cfg const $d = {} if (isObject(date)) { - const now = utc ? dayjs.utc() : dayjs() + const now = new Date() Object.keys(date).forEach((k) => { $d[prettyUnit(k)] = date[k] }) - const d = $d.day || ((!$d.year && !($d.month >= 0)) ? now.date() : 1) - const y = $d.year || now.year() - const M = $d.month >= 0 ? $d.month : ((!$d.year && !$d.day) ? now.month() : 0)// eslint-disable-line no-nested-ternary,max-len + const d = $d.day || ((!$d.year && !($d.month >= 0)) ? now.getDate() : 1) + const y = $d.year || now.getFullYear() + const M = $d.month >= 0 ? $d.month : ((!$d.year && !$d.day) ? now.getMonth() : 0)// eslint-disable-line no-nested-ternary,max-len const h = $d.hour || 0 const m = $d.minute || 0 const s = $d.second || 0 diff --git a/test/plugin/objectSupport.test.js b/test/plugin/objectSupport.test.js index 392bdbf7c..476b97f4c 100755 --- a/test/plugin/objectSupport.test.js +++ b/test/plugin/objectSupport.test.js @@ -21,9 +21,6 @@ const now = new Date() const currentYear = now.getFullYear() const currentMonth = utils.s(now.getMonth() + 1, 2, '0') const currentDate = utils.s(now.getDate(), 2, '0') -const currentUTCYear = now.getUTCFullYear() -const currentUTCMonth = utils.s(now.getUTCMonth() + 1, 2, '0') -const currentUTCDate = utils.s(now.getUTCDate(), 2, '0') const fmt = 'YYYY-MM-DD HH:mm:ss.SSS' const tests = [ [{ year: 2010 }, '2010-01-01 00:00:00.000'], @@ -34,8 +31,7 @@ const tests = [ { hour: 15, minute: 25, second: 50, millisecond: 125 }, - `${currentYear}-${currentMonth}-${currentDate} 15:25:50.125`, - `${currentUTCYear}-${currentUTCMonth}-${currentUTCDate} 15:25:50.125`], + `${currentYear}-${currentMonth}-${currentDate} 15:25:50.125`], [ { year: 2010, month: 1, day: 12, hours: 1 @@ -123,9 +119,8 @@ it('Constructor from Object', () => { it('Constructor from Object UTC', () => { for (let i = 0; i < tests.length; i += 1) { - const result = tests[i][2] || tests[i][1] - expect(dayjs.utc(tests[i][0]).format(fmt)).toBe(result) - expect(moment.utc(tests[i][0]).format(fmt)).toBe(result) + expect(dayjs.utc(tests[i][0]).format(fmt)).toBe(tests[i][1]) + expect(moment.utc(tests[i][0]).format(fmt)).toBe(tests[i][1]) } }) it('Set from Object', () => { From 6a28573b43190db7b2ffa77aec4b64c6510387f3 Mon Sep 17 00:00:00 2001 From: Jukka Raimovaara Date: Sat, 3 Oct 2020 00:33:44 +0300 Subject: [PATCH 09/10] add getLongDateFormat function --- src/plugin/localeData/index.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/plugin/localeData/index.js b/src/plugin/localeData/index.js index 0b80f49e0..2402d4b1d 100644 --- a/src/plugin/localeData/index.js +++ b/src/plugin/localeData/index.js @@ -13,6 +13,10 @@ export default (o, c, dayjs) => { // locale needed later return result.map((_, index) => (result[(index + (weekStart || 0)) % 7])) } const getDayjsLocaleObject = () => dayjs.Ls[dayjs.locale()] + const getLongDateFormat = format => + getDayjsLocaleObject().formats[format] || + t(getDayjsLocaleObject().formats[format.toUpperCase()]) + const localeData = function () { return { months: instance => @@ -25,8 +29,8 @@ export default (o, c, dayjs) => { // locale needed later (instance ? instance.format('dd') : getShort(this, 'weekdaysMin', 'weekdays', 2)), weekdaysShort: instance => (instance ? instance.format('ddd') : getShort(this, 'weekdaysShort', 'weekdays', 3)), - longDateFormat: format => - this.$locale().formats[format] || t(this.$locale().formats[format.toUpperCase()]) + longDateFormat: format => getLongDateFormat(format) + } } proto.localeData = function () { @@ -42,8 +46,7 @@ export default (o, c, dayjs) => { // locale needed later weekdaysMin: () => dayjs.weekdaysMin(), months: () => dayjs.months(), monthsShort: () => dayjs.monthsShort(), - longDateFormat: format => - localeObject.formats[format] || t(localeObject.formats[format.toUpperCase()]) + longDateFormat: format => getLongDateFormat(format) } } From 9dffb350207ed46ede142a45ffd6b6cfb519e281 Mon Sep 17 00:00:00 2001 From: Jukka Raimovaara Date: Sat, 3 Oct 2020 20:38:52 +0300 Subject: [PATCH 10/10] pass the right locale object to getLongDateFormat --- src/plugin/localeData/index.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/plugin/localeData/index.js b/src/plugin/localeData/index.js index 2402d4b1d..503db0de5 100644 --- a/src/plugin/localeData/index.js +++ b/src/plugin/localeData/index.js @@ -13,9 +13,8 @@ export default (o, c, dayjs) => { // locale needed later return result.map((_, index) => (result[(index + (weekStart || 0)) % 7])) } const getDayjsLocaleObject = () => dayjs.Ls[dayjs.locale()] - const getLongDateFormat = format => - getDayjsLocaleObject().formats[format] || - t(getDayjsLocaleObject().formats[format.toUpperCase()]) + const getLongDateFormat = (l, format) => + l.formats[format] || t(l.formats[format.toUpperCase()]) const localeData = function () { return { @@ -29,7 +28,7 @@ export default (o, c, dayjs) => { // locale needed later (instance ? instance.format('dd') : getShort(this, 'weekdaysMin', 'weekdays', 2)), weekdaysShort: instance => (instance ? instance.format('ddd') : getShort(this, 'weekdaysShort', 'weekdays', 3)), - longDateFormat: format => getLongDateFormat(format) + longDateFormat: format => getLongDateFormat(this.$locale(), format) } } @@ -46,7 +45,7 @@ export default (o, c, dayjs) => { // locale needed later weekdaysMin: () => dayjs.weekdaysMin(), months: () => dayjs.months(), monthsShort: () => dayjs.monthsShort(), - longDateFormat: format => getLongDateFormat(format) + longDateFormat: format => getLongDateFormat(localeObject, format) } }