Skip to content

getDayOfWeekCode in date_utils has incorrect behavior. #6217

@ymmt07039

Description

@ymmt07039

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions