@@ -178,23 +178,20 @@ export function getDaysOfMonth(month: Date, weekStartsOn = DayName.SUNDAY): Mont
178
178
179
179
const firstDayInCurrentMonth = firstDate . getDay ( ) ;
180
180
181
- const days : Month [ 'days' ] = Array . from (
182
- { length : 6 * 7 } ,
183
- ( _1 , i ) : DayOfMonth => {
184
- const day = addDays (
185
- firstDate ,
186
- i - firstDayInCurrentMonth - ( dayOffset > firstDayInCurrentMonth ? 7 : 0 ) + dayOffset
187
- ) ;
188
-
189
- return {
190
- __type : DayOfMonthSymbol ,
191
- dateObj : day ,
192
- dayName : DaysOfTheWeek [ ( i + dayOffset ) % 7 ] ,
193
- inCurrentMonth : isSameMonth ( firstDate , day ) ,
194
- ISODateString : toISODateString ( day )
195
- } ;
196
- }
197
- ) ;
181
+ const days : Month [ 'days' ] = Array . from ( { length : 6 * 7 } , ( _1 , i ) : DayOfMonth => {
182
+ const day = addDays (
183
+ firstDate ,
184
+ i - firstDayInCurrentMonth - ( dayOffset > firstDayInCurrentMonth ? 7 : 0 ) + dayOffset
185
+ ) ;
186
+
187
+ return {
188
+ __type : DayOfMonthSymbol ,
189
+ dateObj : day ,
190
+ dayName : DaysOfTheWeek [ ( i + dayOffset ) % 7 ] ,
191
+ inCurrentMonth : isSameMonth ( firstDate , day ) ,
192
+ ISODateString : toISODateString ( day )
193
+ } ;
194
+ } ) ;
198
195
199
196
const daysOfWeek = DaysOfTheWeek . slice ( dayOffset ) . concat ( DaysOfTheWeek . slice ( 0 , dayOffset ) ) ;
200
197
@@ -235,28 +232,26 @@ export function getDaysOfRangeMonth(
235
232
accumulator . daysOfWeek = daysOfWeek . slice ( 0 ) ;
236
233
}
237
234
238
- const daysOfCurrentMonth = days . map (
239
- ( day ) : DayOfRangeMonth => {
240
- const isStart = Boolean ( startDate && isSameDay ( day . dateObj , startDate ) ) ;
241
- const isEnd = Boolean ( endDate && isSameDay ( day . dateObj , endDate ) ) ;
242
-
243
- return {
244
- ...day ,
245
- __type : DayOfRangeMonthSymbol ,
246
- inRange :
247
- isStart ||
248
- isEnd ||
249
- Boolean (
250
- startDate &&
251
- isDayAfter ( day . dateObj , startDate ) &&
252
- endDate &&
253
- isDayBefore ( day . dateObj , endDate )
254
- ) ,
255
- isStart,
256
- isEnd
257
- } ;
258
- }
259
- ) ;
235
+ const daysOfCurrentMonth = days . map ( ( day ) : DayOfRangeMonth => {
236
+ const isStart = Boolean ( startDate && isSameDay ( day . dateObj , startDate ) ) ;
237
+ const isEnd = Boolean ( endDate && isSameDay ( day . dateObj , endDate ) ) ;
238
+
239
+ return {
240
+ ...day ,
241
+ __type : DayOfRangeMonthSymbol ,
242
+ inRange :
243
+ isStart ||
244
+ isEnd ||
245
+ Boolean (
246
+ startDate &&
247
+ isDayAfter ( day . dateObj , startDate ) &&
248
+ endDate &&
249
+ isDayBefore ( day . dateObj , endDate )
250
+ ) ,
251
+ isStart,
252
+ isEnd
253
+ } ;
254
+ } ) ;
260
255
261
256
accumulator . months . push ( {
262
257
days : daysOfCurrentMonth ,
0 commit comments