File tree Expand file tree Collapse file tree
packages/plugin-calendar/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -189,7 +189,8 @@ function getWeekStart(date: Date): Date {
189189 const d = new Date ( date )
190190 const day = d . getDay ( )
191191 const diff = d . getDate ( ) - day
192- return new Date ( d . setDate ( diff ) )
192+ d . setDate ( diff )
193+ return d
193194}
194195
195196function getMonthDays ( date : Date ) : Date [ ] {
@@ -202,7 +203,7 @@ function getMonthDays(date: Date): Date[] {
202203
203204 // Add previous month days
204205 for ( let i = startDay - 1 ; i >= 0 ; i -- ) {
205- const prevDate = new Date ( firstDay )
206+ const prevDate = new Date ( firstDay . getTime ( ) )
206207 prevDate . setDate ( prevDate . getDate ( ) - ( i + 1 ) )
207208 days . push ( prevDate )
208209 }
@@ -215,7 +216,7 @@ function getMonthDays(date: Date): Date[] {
215216 // Add next month days
216217 const remainingDays = 42 - days . length
217218 for ( let i = 1 ; i <= remainingDays ; i ++ ) {
218- const nextDate = new Date ( lastDay )
219+ const nextDate = new Date ( lastDay . getTime ( ) )
219220 nextDate . setDate ( nextDate . getDate ( ) + i )
220221 days . push ( nextDate )
221222 }
You can’t perform that action at this time.
0 commit comments