showonne / vue-date

A datepicker component for Vue.js
https://showonne.github.io/vue-date/
MIT License
156 stars 65 forks source link

切换年份后,日历日期与星期匹配不正确 #7

Closed brucekong closed 7 years ago

brucekong commented 7 years ago

当切换日历年份的时候,每月对应的日期和星期匹配不正确,比如切换到2016年12月1日时,匹配的星期为星期五(Fr),但其实应该是星期四(Th),看了源码发现是在298和299行 ----

  1. let startDay = new Date(this.year, this.tmpMonth, 1).getDay()
  2. let previousMongthLength = new Date(this.year, this.tmpMonth, 0).getDate() 获取当前选择的年份使用的是this.year ,修改为 this.tmpYear 即可。
showonne commented 7 years ago

多谢提醒,已修改。