@@ -101,19 +101,20 @@ export default class DateTimePicker extends SuperComponent {
101101 } ) ;
102102 } ,
103103
104- getDaysOfWeekInMonth ( date : Dayjs ) : Array < { value : string ; label : string } > {
105- const { locale, dayjsLocale } = this . data ;
104+ getDaysOfWeekInMonth ( date : Dayjs , type : string ) : Array < { value : string ; label : string } > {
105+ const { locale, steps , dayjsLocale } = this . data ;
106106 const startOfMonth = date . startOf ( 'month' ) ;
107- const endOfMonth = date . endOf ( 'month' ) ;
107+ const minEdge = this . getOptionEdge ( 'min' , type ) ;
108+ const maxEdge = this . getOptionEdge ( 'max' , type ) ;
109+ const step = steps ?. [ type ] ?? 1 ;
108110 const daysOfWeek = [ ] ;
109111
110- for ( let i = 0 ; i <= endOfMonth . diff ( startOfMonth , 'days' ) ; i += 1 ) {
111- const currentDate = startOfMonth . add ( i , 'days' ) . locale ( dayjsLocale ) ;
112+ for ( let i = minEdge ; i <= maxEdge ; i += step ) {
113+ const currentDate = startOfMonth . date ( i ) . locale ( dayjsLocale ) ;
112114 const dayName = currentDate . format ( 'ddd' ) ;
113-
114115 daysOfWeek . push ( {
115- value : `${ i + 1 } ` ,
116- label : `${ i + 1 } ${ locale . date || '' } ${ dayName } ` ,
116+ value : `${ i } ` ,
117+ label : `${ i } ${ locale . date || '' } ${ dayName } ` ,
117118 } ) ;
118119 }
119120
@@ -217,7 +218,7 @@ export default class DateTimePicker extends SuperComponent {
217218 const dayjsMonthsShort = dayjs ( ) . locale ( this . data . dayjsLocale ) . localeData ( ) . monthsShort ( ) ;
218219
219220 if ( type === 'date' && showWeek ) {
220- return this . getDaysOfWeekInMonth ( this . date ) ;
221+ return this . getDaysOfWeekInMonth ( this . date , type ) ;
221222 }
222223
223224 for ( let i = minEdge ; i <= maxEdge ; i += step ) {
0 commit comments