Skip to content

Commit 57520b4

Browse files
committed
fix(datepicker): Set pageDate to January for year view
1 parent 7596aac commit 57520b4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/components/Datepicker.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -678,9 +678,15 @@ export default {
678678
dateTemp = new Date()
679679
}
680680
}
681-
dateTemp = this.utils.resetDateTime(new Date(dateTemp))
682681
683-
this.pageTimestamp = this.utils.setDate(new Date(dateTemp), 1)
682+
let pageTimestamp = this.utils.resetDateTime(new Date(dateTemp))
683+
pageTimestamp = this.utils.setDate(new Date(pageTimestamp), 1)
684+
685+
if (this.view === 'year') {
686+
pageTimestamp = this.utils.setMonth(new Date(pageTimestamp), 0)
687+
}
688+
689+
this.pageTimestamp = pageTimestamp
684690
},
685691
/**
686692
* Sets the slide duration in milliseconds by looking up the stylesheet

0 commit comments

Comments
 (0)