From deecd6ab8a2f4173ee7046f6b568b41fd2677531 Mon Sep 17 00:00:00 2001 From: iamkun Date: Tue, 13 Oct 2020 17:38:25 +0800 Subject: [PATCH] fix: fix localizedFormat export error (#1133) fix #1132 --- src/plugin/localeData/index.js | 2 +- src/plugin/localizedFormat/index.js | 4 +--- src/plugin/localizedFormat/utils.js | 4 ++++ 3 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 src/plugin/localizedFormat/utils.js diff --git a/src/plugin/localeData/index.js b/src/plugin/localeData/index.js index 503db0de5..65d6e234b 100644 --- a/src/plugin/localeData/index.js +++ b/src/plugin/localeData/index.js @@ -1,4 +1,4 @@ -import { t } from '../localizedFormat' +import { t } from '../localizedFormat/utils' export default (o, c, dayjs) => { // locale needed later const proto = c.prototype diff --git a/src/plugin/localizedFormat/index.js b/src/plugin/localizedFormat/index.js index b56d22527..425226f72 100644 --- a/src/plugin/localizedFormat/index.js +++ b/src/plugin/localizedFormat/index.js @@ -1,7 +1,5 @@ import { FORMAT_DEFAULT } from '../../constant' - -export const t = format => - format.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (_, a, b) => a || b.slice(1)) +import { t } from './utils' export default (o, c, d) => { const proto = c.prototype diff --git a/src/plugin/localizedFormat/utils.js b/src/plugin/localizedFormat/utils.js new file mode 100644 index 000000000..d551194fe --- /dev/null +++ b/src/plugin/localizedFormat/utils.js @@ -0,0 +1,4 @@ +// eslint-disable-next-line import/prefer-default-export +export const t = format => + format.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (_, a, b) => a || b.slice(1)) +