@@ -1944,13 +1944,12 @@ export class IgxTimePickerComponent implements
19441944 this . isNotEmpty = false ;
19451945
19461946 const oldVal = new Date ( this . value ) ;
1947-
19481947 this . displayValue = this . parseMask ( false ) ;
19491948 requestAnimationFrame ( ( ) => {
19501949 this . _setCursorPosition ( 0 ) ;
19511950 } ) ;
1952- // TODO: refactoring - this.value should be null #8135
1953- this . value . setHours ( 0 , 0 ) ;
1951+ // TODO: refactoring - this.value should be null #6585
1952+ this . value ? .setHours ( 0 , 0 , 0 ) ;
19541953
19551954 if ( oldVal . getTime ( ) !== this . value . getTime ( ) ) {
19561955 const args : IgxTimePickerValueChangedEventArgs = {
@@ -1968,7 +1967,7 @@ export class IgxTimePickerComponent implements
19681967 * @hidden
19691968 */
19701969 public onInput ( event ) : void {
1971- const inputMask = event . target . value ;
1970+ const inputMask : string = event . target . value ;
19721971 const oldVal = new Date ( this . value ) ;
19731972
19741973 this . isNotEmpty = inputMask !== this . parseMask ( false ) ;
@@ -1984,20 +1983,19 @@ export class IgxTimePickerComponent implements
19841983 } else {
19851984 const args : IgxTimePickerValidationFailedEventArgs = {
19861985 timePicker : this ,
1987- currentValue : inputMask ,
1986+ currentValue : new Date ( inputMask ) ,
19881987 setThroughUI : false
19891988 } ;
19901989 this . onValidationFailed . emit ( args ) ;
19911990 }
19921991 // handle cases where the user deletes the display value (when pressing backspace or delete)
1993- } else if ( inputMask === this . parseMask ( false ) ) {
1992+ } else if ( ! this . value || inputMask . length === 0 || ! this . isNotEmpty ) {
19941993 this . isNotEmpty = false ;
1995-
1996- // TODO: refactoring - this.value should be null #8135
1997- this . value . setHours ( 0 , 0 ) ;
1994+ // TODO: refactoring - this.value should be null #6585
1995+ this . value ?. setHours ( 0 , 0 , 0 ) ;
19981996 this . displayValue = inputMask ;
1999-
2000- if ( oldVal . getTime ( ) !== this . value . getTime ( ) ) {
1997+ if ( oldVal . getTime ( ) !== this . value ?. getTime ( ) ) {
1998+ // TODO: Do not emit event when the editor is empty #6482
20011999 const args : IgxTimePickerValueChangedEventArgs = {
20022000 oldValue : oldVal ,
20032001 newValue : this . value
@@ -2024,7 +2022,7 @@ export class IgxTimePickerComponent implements
20242022 this . isNotEmpty = value !== '' ;
20252023 this . displayValue = value ;
20262024
2027- if ( value && value !== this . parseMask ( ) ) {
2025+ if ( value && ( value !== this . parseMask ( ) || value !== this . parseMask ( false ) ) ) {
20282026 if ( this . _isEntryValid ( value ) ) {
20292027 const newVal = this . convertMinMaxValue ( value ) ;
20302028 if ( ! this . value || this . value . getTime ( ) !== newVal . getTime ( ) ) {
0 commit comments