Search code examples
reactjscalendarformatlocaleantd

Ant Design Calendar: How to Change the Day of Week Format


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

Calendar Example

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.?


Solution

  • 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"]
    });