配置El-date-ficker

发布于 2025-01-26 06:32:16 字数 856 浏览 0 评论 0 原文

有人知道,如何在Element-Plus中配置El-Date挑选以设置一周的第一天。

文档说它可以通过day.js配置,但不使用emporture day.js中的元素中的configure。

到目前为止,我已经做到了。

import de from 'element-plus/es/locale/lang/de';

const i18n = createI18n({
    legacy: false,
    locale: 'de',
    messages: {
        'de': messagesDe
    },
    datetimeFormats: {
        'de': {
            short: {
                year: 'numeric',
                month: '2-digit',
                day: '2-digit'
            },
            long: {
                year: 'numeric',
                month: '2-digit',
                day: '2-digit',
                hour: '2-digit',
                minute: '2-digit',
                second: '2-digit'
            }
        }
    },
});

app.use(ElementPlus, {
   locale: de,
});
app.use(i18n);

感谢您的帮助。

Does someone know, how to configure a el-date-picker in element-plus to set the first day of week.

The docs say it configurable via day.js but not to use configure day.js in element.

I have done this so far.

import de from 'element-plus/es/locale/lang/de';

const i18n = createI18n({
    legacy: false,
    locale: 'de',
    messages: {
        'de': messagesDe
    },
    datetimeFormats: {
        'de': {
            short: {
                year: 'numeric',
                month: '2-digit',
                day: '2-digit'
            },
            long: {
                year: 'numeric',
                month: '2-digit',
                day: '2-digit',
                hour: '2-digit',
                minute: '2-digit',
                second: '2-digit'
            }
        }
    },
});

app.use(ElementPlus, {
   locale: de,
});
app.use(i18n);

Thank you for your help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

下壹個目標 2025-02-02 06:32:16

“ nofollow noreferrer”> oraround dayjs#dayjs#215 也适用于元素加。

例如,要将星期一设置为 de 语言环境的一周中的第一天,请创建 de 对象, dayjs.ls 和SET WeekStart = 1

// main.js
import dayjs from 'dayjs'

dayjs.Ls.de ??= {}
dayjs.Ls.de.weekStart = 1

demo

The workaround described in dayjs#215 also works for Element Plus.

For example, to set Monday as the first day of the week for the de locale, create a de object off of dayjs.Ls, and set weekStart=1:

// main.js
import dayjs from 'dayjs'

dayjs.Ls.de ??= {}
dayjs.Ls.de.weekStart = 1

demo

腻橙味 2025-02-02 06:32:16

对我而言,仅在main.ts中使用此配置:

import 'dayjs/locale/ru' // locale will imported inside dayjs.Ls(for datepicker use)
import ru from 'element-plus/lib/locale/lang/ru' // global locale for app
    
app.use(ElementPlus, { locale: ru })

For me worked only with this configuration in main.ts:

import 'dayjs/locale/ru' // locale will imported inside dayjs.Ls(for datepicker use)
import ru from 'element-plus/lib/locale/lang/ru' // global locale for app
    
app.use(ElementPlus, { locale: ru })

Link to dayjs locale documentation

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文