0
  • I want to display WeekDay with 3 characters instread of only 2.
  • Is there a straight forward way like <DatePicker useWeekdaysShort={true} />?
Muhammad Abdullah
  • 876
  • 2
  • 8
  • 26

2 Answers2

0

You can use weekdaysShort prop.

() => {
  const WEEKDAYS_SHORT = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
  return <DayPicker  weekdaysShort={WEEKDAYS_SHORT} />
}
Hassan Imam
  • 21,956
  • 5
  • 41
  • 51
0
import { DayPicker, DateFormatter } from 'react-day-picker';

const formatWeekdayName: DateFormatter = (date, options) => (
            <>
                {format(new Date(date), 'EEE', { locale: options?.locale })}
            </>
        );
    <DayPicker
       mode="single"
       fromMonth={new Date(firstAvailableDate)}
       toMonth={new Date(lastAvailableDate)}
       selected={new Date(selectedDeliveryDate)}
       .
       .
       formatters={{ formatWeekdayName }}
    />
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. – DSDmark Jun 23 '23 at 03:35