@@ -116,7 +116,6 @@ export class DatePickerComponent implements OnChanges,
116
116
hideStateHelper : boolean = false ;
117
117
_selected : Moment [ ] = [ ] ;
118
118
inputValue : CalendarValue ;
119
- inputValueType : ECalendarValue ;
120
119
isFocusedTrigger : boolean = false ;
121
120
_currentDateView : Moment ;
122
121
inputElementValue : string ;
@@ -137,7 +136,7 @@ export class DatePickerComponent implements OnChanges,
137
136
set selected ( selected : Moment [ ] ) {
138
137
this . _selected = selected ;
139
138
this . inputElementValue = ( < string [ ] > this . utilsService
140
- . convertFromMomentArray ( this . componentConfig . format , selected , ECalendarValue . StringArr ) )
139
+ . convertFromMomentArray ( this . componentConfig . format , selected , ECalendarValue . StringArr ) )
141
140
. join ( ' | ' ) ;
142
141
const val = this . processOnChangeCallback ( selected ) ;
143
142
this . onChangeCallback ( val , false ) ;
@@ -250,7 +249,7 @@ export class DatePickerComponent implements OnChanges,
250
249
251
250
if ( value || value === '' ) {
252
251
this . selected = this . utilsService
253
- . convertToMomentArray ( value , this . componentConfig . format , this . componentConfig . allowMultiSelect ) ;
252
+ . convertToMomentArray ( value , this . componentConfig . format , this . componentConfig . allowMultiSelect ) ;
254
253
this . init ( ) ;
255
254
} else {
256
255
this . selected = [ ] ;
@@ -264,7 +263,7 @@ export class DatePickerComponent implements OnChanges,
264
263
}
265
264
266
265
onChangeCallback ( _ : any , changedByInput : boolean ) {
267
- } ;
266
+ }
268
267
269
268
registerOnTouched ( fn : any ) : void {
270
269
}
@@ -280,12 +279,12 @@ export class DatePickerComponent implements OnChanges,
280
279
return this . utilsService . convertFromMomentArray (
281
280
this . componentConfig . format ,
282
281
selected ,
283
- this . componentConfig . returnedValueType || this . inputValueType
282
+ this . componentConfig . returnedValueType || this . utilsService . getInputType ( this . inputValue , this . componentConfig . allowMultiSelect )
284
283
) ;
285
284
}
286
285
}
287
286
288
- initValidators ( ) {
287
+ initValidators ( ) : void {
289
288
this . validateFn = this . utilsService . createValidator (
290
289
{
291
290
minDate : this . minDate ,
@@ -296,13 +295,13 @@ export class DatePickerComponent implements OnChanges,
296
295
this . onChangeCallback ( this . processOnChangeCallback ( this . selected ) , false ) ;
297
296
}
298
297
299
- ngOnInit ( ) {
298
+ ngOnInit ( ) : void {
300
299
this . isInitialized = true ;
301
300
this . init ( ) ;
302
301
this . initValidators ( ) ;
303
302
}
304
303
305
- ngOnChanges ( changes : SimpleChanges ) {
304
+ ngOnChanges ( changes : SimpleChanges ) : void {
306
305
if ( this . isInitialized ) {
307
306
const { minDate, maxDate, minTime, maxTime} = changes ;
308
307
@@ -314,15 +313,15 @@ export class DatePickerComponent implements OnChanges,
314
313
}
315
314
}
316
315
317
- ngAfterViewInit ( ) {
316
+ ngAfterViewInit ( ) : void {
318
317
this . setElementPositionInDom ( ) ;
319
318
}
320
319
321
- setDisabledState ( isDisabled : boolean ) {
320
+ setDisabledState ( isDisabled : boolean ) : void {
322
321
this . disabled = isDisabled ;
323
322
}
324
323
325
- setElementPositionInDom ( ) {
324
+ setElementPositionInDom ( ) : void {
326
325
this . calendarWrapper = < HTMLElement > this . calendarContainer . nativeElement ;
327
326
this . setInputElementContainer ( ) ;
328
327
this . popupElem = this . elemRef . nativeElement . querySelector ( '.dp-popup' ) ;
@@ -361,13 +360,12 @@ export class DatePickerComponent implements OnChanges,
361
360
this . currentDateView = this . displayDate
362
361
? this . utilsService . convertToMoment ( this . displayDate , this . componentConfig . format ) . clone ( )
363
362
: this . utilsService
364
- . getDefaultDisplayDate (
365
- this . currentDateView ,
366
- this . selected ,
367
- this . componentConfig . allowMultiSelect ,
368
- this . componentConfig . min
369
- ) ;
370
- this . inputValueType = this . utilsService . getInputType ( this . inputValue , this . componentConfig . allowMultiSelect ) ;
363
+ . getDefaultDisplayDate (
364
+ this . currentDateView ,
365
+ this . selected ,
366
+ this . componentConfig . allowMultiSelect ,
367
+ this . componentConfig . min
368
+ ) ;
371
369
this . dayCalendarConfig = this . dayPickerService . getDayConfigService ( this . componentConfig ) ;
372
370
this . dayTimeCalendarConfig = this . dayPickerService . getDayTimeConfigService ( this . componentConfig ) ;
373
371
this . timeSelectConfig = this . dayPickerService . getTimeConfigService ( this . componentConfig ) ;
@@ -434,14 +432,14 @@ export class DatePickerComponent implements OnChanges,
434
432
} )
435
433
} else {
436
434
this . _selected = this . utilsService
437
- . getValidMomentArray ( strVal , this . componentConfig . format ) ;
435
+ . getValidMomentArray ( strVal , this . componentConfig . format ) ;
438
436
this . onChangeCallback ( this . processOnChangeCallback ( strVal ) , true ) ;
439
437
}
440
438
}
441
439
442
440
dateSelected ( date : IDate , granularity : unitOfTime . Base , type : SelectEvent , ignoreClose ?: boolean ) {
443
441
this . selected = this . utilsService
444
- . updateSelected ( this . componentConfig . allowMultiSelect , this . selected , date , granularity ) ;
442
+ . updateSelected ( this . componentConfig . allowMultiSelect , this . selected , date , granularity ) ;
445
443
if ( ! ignoreClose ) {
446
444
this . onDateClick ( ) ;
447
445
}
0 commit comments