File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -143,7 +143,13 @@ export function getLastFirstDayOfWeek<T extends DateValue = DateValue>(
143143 firstDayOfWeek : number ,
144144 locale : string ,
145145) : T {
146- const day = getDayOfWeek ( date , locale )
146+ /**
147+ * "firstDayOfWeek" is fixed to 0(Sunday) to avoid confusion regarding locales.
148+ * This also aligns with other date libraries, e.g., date-fns.
149+ *
150+ * #see https://github.com/unovue/reka-ui/issues/2157
151+ */
152+ const day = getDayOfWeek ( date , locale , 'sun' )
147153
148154 if ( firstDayOfWeek > day )
149155 return date . subtract ( { days : day + 7 - firstDayOfWeek } ) as T
@@ -159,7 +165,14 @@ export function getNextLastDayOfWeek<T extends DateValue = DateValue>(
159165 firstDayOfWeek : number ,
160166 locale : string ,
161167) : T {
162- const day = getDayOfWeek ( date , locale )
168+ /**
169+ * "firstDayOfWeek" is fixed to 0(Sunday) to avoid confusion regarding locales.
170+ * This also aligns with other date libraries, e.g., date-fns.
171+ *
172+ * #see https://github.com/unovue/reka-ui/issues/2157
173+ */
174+ const day = getDayOfWeek ( date , locale , 'sun' )
175+
163176 const lastDayOfWeek = firstDayOfWeek === 0 ? 6 : firstDayOfWeek - 1
164177
165178 if ( day === lastDayOfWeek )
You can’t perform that action at this time.
0 commit comments