Describe the bug
getDayOfWeekCode in date_utils returns an incorrect value.
It is expected to return day-of-week codes such as sun, mon, tue, but currently returns the day of year month.
Expected behavior
getDayOfWeekCode should return lowercase day-of-week codes such as sun, mon, tue (see #800).
Additional context
- The current behavior occurs because the format
ddd is used.
- In date-fns, the correct format for day of week is
eee.
- The locale needs to be fixed to
en, and the result needs to be converted to lowercase.
- Reference code:
|
export function getDayOfWeekCode(day: Date, locale?: Locale): string { |
|
return formatDate(day, "ddd", locale); |
|
} |
- date-fns format document:
https://date-fns.org/docs/format
Describe the bug
getDayOfWeekCodeindate_utilsreturns an incorrect value.It is expected to return day-of-week codes such as
sun,mon,tue, but currently returns the day ofyearmonth.Expected behavior
getDayOfWeekCodeshould return lowercase day-of-week codes such assun,mon,tue(see #800).Additional context
dddis used.eee.en, and the result needs to be converted to lowercase.react-datepicker/src/date_utils.ts
Lines 592 to 594 in 548a1f3
https://date-fns.org/docs/format