icai/vue3-calendar

when inputValue date is overflow nextMonth date,new Date(nextMonth.year, nextMonth.month, date) is wrong

snail3157 opened this issue · 1 comments

in method preNextMonthClick:
this.currDate = new Date(nextMonth.year, nextMonth.month, date)
when inputValue date is not in nextMonth date
for example :inputValue is 2018-05-31
new Date(2018, 5, 31) = Sun Jul 01 2018 00:00:00
so preNextMonthClick('nextMonth') is Jul not June.
i set 475: const date = 1.
let activeDay = new Date(this.inputValue).getDate() 。before 629 for cycle
659: i === activeDay

中文: 英语很差,还是加上中文描述一下吧,当inputValue时间是2018-05-31时,由于6月没有31,所以new Date(2018, 5, 31) 会变成7月,于是我把日期设为1,然后判断datepicker-dateRange-item-active这里直接用inputValue的值,为了性能考虑,不必每次for中再重新new Date(this.inputValue).getDate(),所以写在了for循环外。
还有刚打开项目时,由于eslint,第一次运行时是运行不起来的,建议完善一下~

最后感谢你无私的开源~

icai commented

eslint error had fixed, #29, see the latest commit.
welcome to Pull Request