@@ -188,7 +188,6 @@ export default {
188188 }
189189 } ,
190190 created ( ) {
191- this . dateRange = this . initRange || null
192191 if ( this . isCompact ) {
193192 this . isOpen = true
194193 }
@@ -270,15 +269,15 @@ export default {
270269 // bound by > 0 and < last day of month
271270 return result > 0 && result <= endMonthDate ? result : ' '
272271 } ,
273- getNewDateRange ( result , activeMonth ) {
272+ getNewDateRange ( result , activeMonth , activeYear ) {
274273 const newData = { }
275274 let key = 'start'
276275 if ( ! this . isFirstChoice ) {
277276 key = 'end'
278277 } else {
279278 newData [ 'end' ] = null
280279 }
281- const resultDate = new Date ( this . activeYearStart , activeMonth , result )
280+ const resultDate = new Date ( activeYear , activeMonth , result )
282281 if ( ! this . isFirstChoice && resultDate < this . dateRange . start ) {
283282 this . isFirstChoice = false
284283 return { start : resultDate }
@@ -291,7 +290,8 @@ export default {
291290 } ,
292291 selectFirstItem ( r , i ) {
293292 const result = this . getDayIndexInMonth ( r , i , this . startMonthDay ) + 1
294- this . dateRange = Object . assign ( { } , this . dateRange , this . getNewDateRange ( result , this . activeMonthStart ) )
293+ this . dateRange = Object . assign ( { } , this . dateRange , this . getNewDateRange ( result , this . activeMonthStart ,
294+ this . activeYearStart ) )
295295 if ( this . dateRange . start && this . dateRange . end ) {
296296 this . presetActive = ''
297297 if ( this . isCompact ) {
@@ -301,7 +301,8 @@ export default {
301301 } ,
302302 selectSecondItem ( r , i ) {
303303 const result = this . getDayIndexInMonth ( r , i , this . startNextMonthDay ) + 1
304- this . dateRange = Object . assign ( { } , this . dateRange , this . getNewDateRange ( result , this . startNextActiveMonth ) )
304+ this . dateRange = Object . assign ( { } , this . dateRange , this . getNewDateRange ( result , this . startNextActiveMonth ,
305+ this . activeYearEnd ) )
305306 if ( this . dateRange . start && this . dateRange . end ) {
306307 this . presetActive = ''
307308 }
0 commit comments