From 7ae1a1d8bdb076c1467f1ef8f1abfff6eca32345 Mon Sep 17 00:00:00 2001 From: Bernhard P <6582465+BePo65@users.noreply.github.com> Date: Sun, 9 Oct 2022 16:09:13 +0200 Subject: [PATCH] refactor: move declaration for english 'ordinal' to 'en' locale file (#2071) * refactor: move declaration for english 'ordinal' to 'en' locale file * fix: lint issue in this pr --- src/locale/en.js | 7 ++++++- src/plugin/advancedFormat/index.js | 8 +------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/locale/en.js b/src/locale/en.js index 71c2f226e..2913d5772 100644 --- a/src/locale/en.js +++ b/src/locale/en.js @@ -3,5 +3,10 @@ export default { name: 'en', weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'), - months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_') + months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'), + ordinal: (n) => { + const s = ['th', 'st', 'nd', 'rd'] + const v = n % 100 + return `[${n}${(s[(v - 20) % 10] || s[v] || s[0])}]` + } } diff --git a/src/plugin/advancedFormat/index.js b/src/plugin/advancedFormat/index.js index a78296f7a..7794af987 100644 --- a/src/plugin/advancedFormat/index.js +++ b/src/plugin/advancedFormat/index.js @@ -1,14 +1,8 @@ import { FORMAT_DEFAULT } from '../../constant' -export default (o, c, d) => { // locale needed later +export default (o, c) => { // locale needed later const proto = c.prototype const oldFormat = proto.format - d.en.ordinal = (number) => { - const s = ['th', 'st', 'nd', 'rd'] - const v = number % 100 - return `[${number}${(s[(v - 20) % 10] || s[v] || s[0])}]` - } - // extend en locale here proto.format = function (formatStr) { const locale = this.$locale()