@@ -166,16 +166,16 @@ export class IgxTimePickerComponent extends PickerBaseDirective
166
166
public mode : PickerInteractionMode = PickerInteractionMode . DropDown ;
167
167
168
168
/**
169
- * The minimum value the picker will accept.
170
- *
171
- * @remarks
172
- * If a `string` value is passed in, it must be in ISO format.
173
- *
174
- * @example
175
- * ```html
176
- * <igx-time-picker [minValue]="18:00:00"></igx-time-picker>
177
- * ```
178
- */
169
+ * The minimum value the picker will accept.
170
+ *
171
+ * @remarks
172
+ * If a `string` value is passed in, it must be in ISO format.
173
+ *
174
+ * @example
175
+ * ```html
176
+ * <igx-time-picker [minValue]="18:00:00"></igx-time-picker>
177
+ * ```
178
+ */
179
179
@Input ( )
180
180
public set minValue ( value : Date | string ) {
181
181
this . _minValue = value ;
@@ -187,16 +187,16 @@ export class IgxTimePickerComponent extends PickerBaseDirective
187
187
}
188
188
189
189
/**
190
- * The maximum value the picker will accept.
191
- *
192
- * @remarks
193
- * If a `string` value is passed in, it must be in ISO format.
194
- *
195
- * @example
196
- * ```html
197
- * <igx-time-picker [maxValue]="20:30:00"></igx-time-picker>
198
- * ```
199
- */
190
+ * The maximum value the picker will accept.
191
+ *
192
+ * @remarks
193
+ * If a `string` value is passed in, it must be in ISO format.
194
+ *
195
+ * @example
196
+ * ```html
197
+ * <igx-time-picker [maxValue]="20:30:00"></igx-time-picker>
198
+ * ```
199
+ */
200
200
@Input ( )
201
201
public set maxValue ( value : Date | string ) {
202
202
this . _maxValue = value ;
@@ -219,10 +219,10 @@ export class IgxTimePickerComponent extends PickerBaseDirective
219
219
220
220
/**
221
221
* Sets the orientation of the picker's header.
222
- *
222
+ *
223
223
* @remarks
224
224
* Available in dialog mode only. Default value is `horizontal`.
225
- *
225
+ *
226
226
* ```html
227
227
* <igx-time-picker [headerOrientation]="'vertical'"></igx-time-picker>
228
228
* ```
@@ -484,17 +484,17 @@ export class IgxTimePickerComponent extends PickerBaseDirective
484
484
485
485
486
486
/**
487
- * The currently selected value / time from the drop-down/dialog
488
- *
489
- * @remarks
490
- * The current value is of type `Date`
491
- *
492
- * @example
493
- * ```typescript
494
- * const newValue: Date = new Date(2000, 2, 2, 10, 15, 15);
495
- * this.timePicker.value = newValue;
496
- * ```
497
- */
487
+ * The currently selected value / time from the drop-down/dialog
488
+ *
489
+ * @remarks
490
+ * The current value is of type `Date`
491
+ *
492
+ * @example
493
+ * ```typescript
494
+ * const newValue: Date = new Date(2000, 2, 2, 10, 15, 15);
495
+ * this.timePicker.value = newValue;
496
+ * ```
497
+ */
498
498
public get value ( ) : Date | string {
499
499
return this . _value ;
500
500
}
@@ -579,7 +579,8 @@ export class IgxTimePickerComponent extends PickerBaseDirective
579
579
}
580
580
581
581
/**
582
- * Delta values used to increment or decrement each editor date part on spin actions and to display time portions in the dropdown/dialog.
582
+ * Delta values used to increment or decrement each editor date part on spin actions and
583
+ * to display time portions in the dropdown/dialog.
583
584
* By default `itemsDelta` is set to `{hour: 1, minute: 1, second: 1}`
584
585
* ```html
585
586
* <igx-time-picker [itemsDelta]="{hour:3, minute:5, second:10}" id="time-picker"></igx-time-picker>
@@ -728,15 +729,15 @@ export class IgxTimePickerComponent extends PickerBaseDirective
728
729
}
729
730
730
731
/**
731
- * Closes the dropdown/dialog.
732
- * ```html
733
- * <igx-time-picker #timePicker></igx-time-picker>
734
- * ```
735
- * ```typescript
736
- * @ViewChild ('timePicker', { read: IgxTimePickerComponent }) picker: IgxTimePickerComponent;
737
- * picker.close();
738
- * ```
739
- */
732
+ * Closes the dropdown/dialog.
733
+ * ```html
734
+ * <igx-time-picker #timePicker></igx-time-picker>
735
+ * ```
736
+ * ```typescript
737
+ * @ViewChild ('timePicker', { read: IgxTimePickerComponent }) picker: IgxTimePickerComponent;
738
+ * picker.close();
739
+ * ```
740
+ */
740
741
public close ( ) : void {
741
742
this . toggleRef . close ( ) ;
742
743
}
@@ -750,12 +751,13 @@ export class IgxTimePickerComponent extends PickerBaseDirective
750
751
}
751
752
752
753
/**
753
- * Clears the time picker value if it is a `string` or resets the time to `00:00:00` if the value is a Date object.
754
- * @example
755
- * ```typescript
756
- * this.timePicker.clear();
757
- * ```
758
- */
754
+ * Clears the time picker value if it is a `string` or resets the time to `00:00:00` if the value is a Date object.
755
+ *
756
+ * @example
757
+ * ```typescript
758
+ * this.timePicker.clear();
759
+ * ```
760
+ */
759
761
public clear ( ) : void {
760
762
if ( this . disabled ) {
761
763
return ;
@@ -780,12 +782,12 @@ export class IgxTimePickerComponent extends PickerBaseDirective
780
782
}
781
783
782
784
/**
783
- * Selects time from the igxTimePicker.
785
+ * Selects time from the igxTimePicker.
784
786
*
785
787
* @example
786
788
* ```typescript
787
789
* this.timePicker.select(date);
788
- *
790
+ *
789
791
* @param date Date object containing the time to be selected.
790
792
*/
791
793
public select ( date : Date | string ) : void {
@@ -798,10 +800,10 @@ export class IgxTimePickerComponent extends PickerBaseDirective
798
800
}
799
801
800
802
/**
801
- * Increment specified TimePart.
802
- *
803
- * @param datePart The optional DatePart to increment. Defaults to Hours.
804
- */
803
+ * Increment specified TimePart.
804
+ *
805
+ * @param datePart The optional DatePart to increment. Defaults to Hours.
806
+ */
805
807
public increment ( datePart ?: DatePart ) : void {
806
808
const timePart = datePart ? datePart : DatePart . Hours ;
807
809
@@ -813,10 +815,10 @@ export class IgxTimePickerComponent extends PickerBaseDirective
813
815
}
814
816
815
817
/**
816
- * Decrement specified TimePart.
817
- *
818
- * @param datePart The optional DatePart to decrement. Defaults to Hours.
819
- */
818
+ * Decrement specified TimePart.
819
+ *
820
+ * @param datePart The optional DatePart to decrement. Defaults to Hours.
821
+ */
820
822
public decrement ( datePart ?: DatePart ) : void {
821
823
const timePart = datePart ? datePart : DatePart . Hours ;
822
824
@@ -841,7 +843,7 @@ export class IgxTimePickerComponent extends PickerBaseDirective
841
843
case 'hourList' :
842
844
const previousDate = new Date ( date ) ;
843
845
let ampm : string ;
844
- let selectedHour = parseInt ( item , 10 ) ;
846
+ const selectedHour = parseInt ( item , 10 ) ;
845
847
let hours = selectedHour ;
846
848
847
849
if ( this . showAmPmList ) {
@@ -887,13 +889,13 @@ export class IgxTimePickerComponent extends PickerBaseDirective
887
889
break ;
888
890
}
889
891
case 'ampmList' : {
890
- let hours = this . _selectedDate . getHours ( ) ;
891
- hours = item === 'AM' ? hours - 12 : hours + 12 ;
892
- date . setHours ( hours ) ;
892
+ let hour = this . _selectedDate . getHours ( ) ;
893
+ hour = item === 'AM' ? hour - 12 : hour + 12 ;
894
+ date . setHours ( hour ) ;
893
895
date = this . validateDropdownValue ( date , true ) ;
894
- hours = this . toTwelveHourFormat ( date . getHours ( ) ) ;
896
+ hour = this . toTwelveHourFormat ( date . getHours ( ) ) ;
895
897
this . _ampmView = this . scrollListItem ( item , this . _ampmItems , DatePart . AmPm ) ;
896
- this . _hourView = this . scrollListItem ( hours , this . _hourItems , DatePart . Hours ) ;
898
+ this . _hourView = this . scrollListItem ( hour , this . _hourItems , DatePart . Hours ) ;
897
899
this . _selectedDate = date ;
898
900
this . updateSelectedMinutes ( ) ;
899
901
this . updateSelectedSeconds ( ) ;
@@ -909,7 +911,7 @@ export class IgxTimePickerComponent extends PickerBaseDirective
909
911
const previousDate = new Date ( this . _selectedDate ) ;
910
912
const minHours = this . _minDropdownValue ?. getHours ( ) || 0 ;
911
913
const maxHours = this . _maxDropdownValue ?. getHours ( ) || 24 ;
912
- let previousHours = previousDate . getHours ( ) ;
914
+ const previousHours = previousDate . getHours ( ) ;
913
915
let hours = previousHours + delta * this . itemsDelta . hour ;
914
916
if ( ( previousHours === maxHours && delta > 0 ) || ( previousHours === minHours && delta < 0 ) ) {
915
917
hours = ! this . spinLoop ? previousHours : delta > 0 ? minHours : maxHours ;
@@ -1205,7 +1207,8 @@ export class IgxTimePickerComponent extends PickerBaseDirective
1205
1207
this . _onTouchedCallback ( ) ;
1206
1208
1207
1209
if ( this . showHoursList ) {
1208
- const selectedHour = this . isTwelveHourFormat ? this . toTwelveHourFormat ( this . _selectedDate . getHours ( ) ) : this . _selectedDate . getHours ( ) ;
1210
+ const hours = this . _selectedDate . getHours ( ) ;
1211
+ const selectedHour = this . isTwelveHourFormat ? this . toTwelveHourFormat ( hours ) : hours ;
1209
1212
this . _hourView = this . scrollListItem ( selectedHour , this . _hourItems , DatePart . Hours ) ;
1210
1213
}
1211
1214
if ( this . showMinutesList ) {
@@ -1237,13 +1240,11 @@ export class IgxTimePickerComponent extends PickerBaseDirective
1237
1240
}
1238
1241
1239
1242
private findArrayMinMax ( array : any [ ] ) : any {
1240
- const filteredArray = array . filter ( function ( val ) {
1241
- return val !== null
1242
- } ) ;
1243
+ const filteredArray = array . filter ( val => val !== null ) ;
1243
1244
return {
1244
1245
min : Math . min ( ...filteredArray ) ,
1245
1246
max : Math . max ( ...filteredArray )
1246
- }
1247
+ } ;
1247
1248
}
1248
1249
1249
1250
private updateSelectedMinutes ( ) {
@@ -1378,15 +1379,18 @@ export class IgxTimePickerComponent extends PickerBaseDirective
1378
1379
}
1379
1380
1380
1381
private toISOString ( value : Date ) : string {
1381
- return value . toLocaleTimeString ( " en-GB" , {
1382
- hour : " 2-digit" ,
1383
- minute : " 2-digit" ,
1384
- second : " 2-digit" ,
1382
+ return value . toLocaleTimeString ( ' en-GB' , {
1383
+ hour : ' 2-digit' ,
1384
+ minute : ' 2-digit' ,
1385
+ second : ' 2-digit' ,
1385
1386
} ) ;
1386
1387
}
1387
1388
1388
1389
private isTimePart ( datePart : DatePart ) : boolean {
1389
- return ( datePart === DatePart . Hours || datePart === DatePart . Minutes || datePart === DatePart . Seconds || datePart === DatePart . AmPm ) ;
1390
+ return ( datePart === DatePart . Hours ||
1391
+ datePart === DatePart . Minutes ||
1392
+ datePart === DatePart . Seconds ||
1393
+ datePart === DatePart . AmPm ) ;
1390
1394
}
1391
1395
1392
1396
private toTwelveHourFormat ( hour : number ) : number {
0 commit comments