Ant Design Calendar:如何更改星期几格式 [英] Ant Design Calendar: How to Change the Day of Week Format

查看:507
本文介绍了Ant Design Calendar:如何更改星期几格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的项目中使用

当前的星期几格式为 dd.例如.sumotu

是否可以通过 props 将格式更改为 ddd.例如.SunMonTue 等等?

解决方案

不支持直接在 ant 设计组件上更改,但是 Ant Design 正在使用 moment ,它使用 locale.weekdaysMin,因此您可以导入 moment 并更改它们:

从'时刻'导入时刻moment.updateLocale('en', {工作日分钟:[周日"、周一"、周二"、周三"、周四"、周五"、周六"]});

I'm using the Ant Design Calendar Component in my project and I have it set up as follows:

Currently the Day of Week format is dd. Eg. Su, Mo, Tu, etc.

Is it possible to change the format via props to ddd. Eg. Sun, Mon, Tue, etc.?

解决方案

There is no support for changing that directly on ant design component, but Ant Design under the hood is using moment which is using locale.weekdaysMin, so you can import moment and change them:

import moment from 'moment'

moment.updateLocale('en', {
  weekdaysMin : ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
});

这篇关于Ant Design Calendar:如何更改星期几格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆