-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Open
Description
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
dddis 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:
react-datepicker/src/date_utils.ts
Lines 592 to 594 in 548a1f3
export function getDayOfWeekCode(day: Date, locale?: Locale): string { return formatDate(day, "ddd", locale); } - date-fns format document:
https://date-fns.org/docs/format
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels