From 79fa028a772417aadcb919f4f11e521016d5ee52 Mon Sep 17 00:00:00 2001 From: Shalabh Gupta Date: Mon, 9 Mar 2026 15:55:08 +0530 Subject: [PATCH] fix: correct getDayOfWeekCode to return day of week instead of day of month MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #6217 Changed getDayOfWeekCode() to use format 'eee' instead of 'ddd' with enUS locale. The previous implementation used format 'ddd' which returns the day of the month (1-31) instead of the day of week code (sun, mon, tue, etc.). This was causing incorrect behavior when the function was used to determine day-of-week codes for calendar operations. As per date-fns documentation: - 'ddd' = day of month with ordinal (1st, 2nd, etc.) - 'eee' = day of week abbreviated (Sun, Mon, Tue, etc.) The fix uses 'eee' with enUS locale and converts to lowercase to return the expected day-of-week codes: sun, mon, tue, wed, thu, fri, sat. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/date_utils.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/date_utils.ts b/src/date_utils.ts index 7fba0d960..e295f5d31 100644 --- a/src/date_utils.ts +++ b/src/date_utils.ts @@ -59,6 +59,7 @@ import { subYears, toDate, } from "date-fns"; +import { enUS } from "date-fns/locale"; import type { Locale as DateFnsLocale, Day } from "date-fns"; @@ -590,7 +591,7 @@ export function getWeek(date: Date): number { * @returns - The day of the week code. */ export function getDayOfWeekCode(day: Date, locale?: Locale): string { - return formatDate(day, "ddd", locale); + return formatDate(day, "eee", enUS).toLowerCase(); } // *** Start of ***