11
11
*/
12
12
13
13
import {
14
- isDate ,
14
+ toDate1 ,
15
15
nextDate ,
16
- parseDate ,
16
+ parseDate1 ,
17
17
formatDate ,
18
18
modifyDate ,
19
19
modifyTime ,
20
20
nextYear ,
21
21
prevYear ,
22
- nextMonth ,
22
+ nextMonth1 ,
23
23
prevMonth ,
24
24
modifyWithTimeString
25
- } from '../common/deps/date-util '
25
+ } from '@opentiny/utils '
26
26
27
27
export const calcDefaultValue = ( defaultVal ) => {
28
28
if ( Array . isArray ( defaultVal ) ) {
@@ -115,7 +115,7 @@ export const watchMinDate =
115
115
const format = 'HH:mm:ss'
116
116
117
117
minTimePicker . state . selectableRange = [
118
- [ parseDate ( formatDate ( state . minDate , format , t ) , format , t ) , parseDate ( '23:59:59' , format , t ) ]
118
+ [ parseDate1 ( formatDate ( state . minDate , format , t ) , format , t ) , parseDate1 ( '23:59:59' , format , t ) ]
119
119
]
120
120
}
121
121
@@ -164,8 +164,8 @@ export const watchValue =
164
164
state . minDate = null
165
165
state . maxDate = null
166
166
} else if ( Array . isArray ( value ) ) {
167
- state . minDate = isDate ( value [ 0 ] ) ? new Date ( value [ 0 ] ) : null
168
- state . maxDate = isDate ( value [ 1 ] ) ? new Date ( value [ 1 ] ) : null
167
+ state . minDate = toDate1 ( value [ 0 ] ) ? new Date ( value [ 0 ] ) : null
168
+ state . maxDate = toDate1 ( value [ 1 ] ) ? new Date ( value [ 1 ] ) : null
169
169
170
170
if ( state . minDate ) {
171
171
state . leftDate = state . minDate
@@ -177,13 +177,13 @@ export const watchValue =
177
177
const maxDateMonth = state . maxDate . getMonth ( )
178
178
179
179
state . rightDate =
180
- minDateYear === maxDateYear && minDateMonth === maxDateMonth ? nextMonth ( state . maxDate ) : state . maxDate
180
+ minDateYear === maxDateYear && minDateMonth === maxDateMonth ? nextMonth1 ( state . maxDate ) : state . maxDate
181
181
} else {
182
- state . rightDate = nextMonth ( state . leftDate )
182
+ state . rightDate = nextMonth1 ( state . leftDate )
183
183
}
184
184
} else {
185
185
state . leftDate = calcDefaultValue ( state . defaultValue ) [ 0 ]
186
- state . rightDate = nextMonth ( state . leftDate )
186
+ state . rightDate = nextMonth1 ( state . leftDate )
187
187
}
188
188
}
189
189
}
@@ -195,7 +195,7 @@ export const watchDefault =
195
195
const [ left , right ] = calcDefaultValue ( value )
196
196
197
197
state . leftDate = left
198
- state . rightDate = value && value [ 1 ] && state . unlinkPanels ? right : nextMonth ( state . leftDate )
198
+ state . rightDate = value && value [ 1 ] && state . unlinkPanels ? right : nextMonth1 ( state . leftDate )
199
199
}
200
200
}
201
201
@@ -205,7 +205,7 @@ export const handleClear =
205
205
state . minDate = null
206
206
state . maxDate = null
207
207
state . leftDate = calcDefaultValue ( state . defaultValue ) [ 0 ]
208
- state . rightDate = nextMonth ( state . leftDate )
208
+ state . rightDate = nextMonth1 ( state . leftDate )
209
209
state . rangeState . selecting = false
210
210
// tiny 新增下面行
211
211
state . rangeState . endDate = null
@@ -228,7 +228,7 @@ export const handleDateInput =
228
228
return
229
229
}
230
230
231
- const parsedValue = parseDate ( value , state . dateFormat , t )
231
+ const parsedValue = parseDate1 ( value , state . dateFormat , t )
232
232
233
233
if ( parsedValue ) {
234
234
if ( typeof state . disabledDate === 'function' && state . disabledDate ( new Date ( parsedValue ) ) ) {
@@ -246,7 +246,7 @@ export const handleDateInput =
246
246
state . leftDate = new Date ( parsedValue )
247
247
248
248
if ( ! state . unlinkPanels ) {
249
- state . rightDate = nextMonth ( state . leftDate )
249
+ state . rightDate = nextMonth1 ( state . leftDate )
250
250
}
251
251
} else {
252
252
state . maxDate = modifyDate (
@@ -268,7 +268,7 @@ export const handleDateInput =
268
268
export const handleDateChange =
269
269
( { state, t } ) =>
270
270
( value , type ) => {
271
- const parsedValue = parseDate ( value , state . dateFormat , t )
271
+ const parsedValue = parseDate1 ( value , state . dateFormat , t )
272
272
273
273
if ( parsedValue ) {
274
274
if ( type === 'min' ) {
@@ -306,7 +306,7 @@ export const handleTimeInput =
306
306
return
307
307
}
308
308
309
- const parsedValue = parseDate ( value , state . timeFormat , t )
309
+ const parsedValue = parseDate1 ( value , state . timeFormat , t )
310
310
311
311
if ( parsedValue ) {
312
312
if ( type === 'min' ) {
@@ -330,7 +330,7 @@ export const handleTimeInput =
330
330
export const handleTimeChange =
331
331
( { state, t, vm } ) =>
332
332
( value , type ) => {
333
- const parsedValue = parseDate ( value , state . timeFormat , t )
333
+ const parsedValue = parseDate1 ( value , state . timeFormat , t )
334
334
335
335
if ( parsedValue ) {
336
336
if ( type === 'min' ) {
@@ -410,10 +410,10 @@ export const handleShortcutClick = (state, api) => (shortcut) => {
410
410
state . shortcutType = shortcut . type
411
411
state . shortcutText = shortcut . text
412
412
413
- if ( shortcut . type === 'startFrom' && shortcut . endDate && isDate ( shortcut . endDate ) ) {
413
+ if ( shortcut . type === 'startFrom' && shortcut . endDate && toDate1 ( shortcut . endDate ) ) {
414
414
state . maxRangeDate = shortcut . endDate
415
415
}
416
- if ( shortcut . type === 'endAt' && shortcut . startDate && isDate ( shortcut . startDate ) ) {
416
+ if ( shortcut . type === 'endAt' && shortcut . startDate && toDate1 ( shortcut . startDate ) ) {
417
417
state . minRangeDate = shortcut . startDate
418
418
}
419
419
@@ -480,7 +480,7 @@ export const leftPrevYear =
480
480
state . leftDate = prevYear ( state . leftDate )
481
481
482
482
if ( ! state . unlinkPanels ) {
483
- state . rightDate = nextMonth ( state . leftDate )
483
+ state . rightDate = nextMonth1 ( state . leftDate )
484
484
}
485
485
}
486
486
@@ -490,7 +490,7 @@ export const leftPrevMonth =
490
490
state . leftDate = prevMonth ( state . leftDate )
491
491
492
492
if ( ! state . unlinkPanels ) {
493
- state . rightDate = nextMonth ( state . leftDate )
493
+ state . rightDate = nextMonth1 ( state . leftDate )
494
494
}
495
495
}
496
496
@@ -501,7 +501,7 @@ export const rightNextYear =
501
501
502
502
if ( ! unlinkPanels ) {
503
503
state . leftDate = nextYear ( leftDate )
504
- state . rightDate = nextMonth ( state . leftDate )
504
+ state . rightDate = nextMonth1 ( state . leftDate )
505
505
} else {
506
506
state . rightDate = nextYear ( rightDate )
507
507
}
@@ -511,10 +511,10 @@ export const rightNextMonth =
511
511
( { state } ) =>
512
512
( ) => {
513
513
if ( ! state . unlinkPanels ) {
514
- state . leftDate = nextMonth ( state . leftDate )
515
- state . rightDate = nextMonth ( state . leftDate )
514
+ state . leftDate = nextMonth1 ( state . leftDate )
515
+ state . rightDate = nextMonth1 ( state . leftDate )
516
516
} else {
517
- state . rightDate = nextMonth ( state . rightDate )
517
+ state . rightDate = nextMonth1 ( state . rightDate )
518
518
}
519
519
}
520
520
@@ -526,7 +526,7 @@ export const leftNextYear =
526
526
export const leftNextMonth =
527
527
( { state } ) =>
528
528
( ) =>
529
- ( state . leftDate = nextMonth ( state . leftDate ) )
529
+ ( state . leftDate = nextMonth1 ( state . leftDate ) )
530
530
531
531
export const rightPrevYear =
532
532
( { state } ) =>
@@ -553,16 +553,16 @@ export const isValidValue =
553
553
value &&
554
554
value [ 0 ] &&
555
555
value [ 1 ] &&
556
- isDate ( value [ 0 ] ) &&
557
- isDate ( value [ 1 ] ) &&
556
+ toDate1 ( value [ 0 ] ) &&
557
+ toDate1 ( value [ 1 ] ) &&
558
558
value [ 0 ] . getTime ( ) <= value [ 1 ] . getTime ( ) &&
559
559
( typeof state . disabledDate === 'function' ? ! state . disabledDate ( value [ 0 ] ) && ! state . disabledDate ( value [ 1 ] ) : true )
560
560
561
561
export const resetView =
562
562
( { state } ) =>
563
563
( ) => {
564
- state . minDate = state . value && isDate ( state . value [ 0 ] ) ? new Date ( state . value [ 0 ] ) : null
565
- state . maxDate = state . value && isDate ( state . value [ 0 ] ) ? new Date ( state . value [ 1 ] ) : null
564
+ state . minDate = state . value && toDate1 ( state . value [ 0 ] ) ? new Date ( state . value [ 0 ] ) : null
565
+ state . maxDate = state . value && toDate1 ( state . value [ 0 ] ) ? new Date ( state . value [ 1 ] ) : null
566
566
}
567
567
568
568
export const setTimeFormat =
0 commit comments