i am using antd RangePicker to get start and end value of date. my calanders starts from sunday but i want to start it from monday
enter image description here
i have try this solution but nothing works
import { LocaleProvider, Calendar } from 'antd';
import en_GB from 'antd/lib/locale-provider/en_GB';
<LocaleProvider locale={en_GB}>
<Calendar
dateFullCellRender={dateFullCellRender}
onSelect={this.onSelect}
defaultValue={this.state.selectedDate}
...
/></LocaleProvider>
i am using antd RangePicker to get start and end value of date. my calanders starts from sunday but i want to start it from monday
enter image description here
i have try this solution but nothing works
import { LocaleProvider, Calendar } from 'antd';
import en_GB from 'antd/lib/locale-provider/en_GB';
<LocaleProvider locale={en_GB}>
<Calendar
dateFullCellRender={dateFullCellRender}
onSelect={this.onSelect}
defaultValue={this.state.selectedDate}
...
/></LocaleProvider>
Share
Improve this question
asked Dec 16, 2021 at 7:31
TariQ Mahmood AliTariQ Mahmood Ali
431 silver badge6 bronze badges
2 Answers
Reset to default 7The antd doc doesn't work for me.
This works for me:
import dayjs from 'dayjs';
import updateLocale from 'dayjs/plugin/updateLocale';
dayjs.extend(updateLocale)
dayjs.updateLocale('en', {
weekStart: 1
})
From antd documentation here
import 'moment/locale/en-gb';
import locale from 'antd/es/locale/en_GB';
import moment from 'moment';
moment.locale('en-gb', {
week: {
dow: 1 /// Date offset
}
});
EDIT: Seems that after a few years, the way of doing this has changed (Again according to the linked documentation), now it should be done this way:
import dayjs from 'dayjs';
import 'dayjs/locale/en_GB';
import 'dayjs/plugin/updateLocale';
dayjs.updateLocale('en_gb', {
weekStart: 0,
});