@@ -50,7 +50,7 @@ import { ITimePickerResourceStrings } from '../core/i18n/time-picker-resources';
5050import { CurrentResourceStrings } from '../core/i18n/resources' ;
5151import { KEYS , CancelableBrowserEventArgs , IBaseEventArgs } from '../core/utils' ;
5252import { InteractionMode } from '../core/enums' ;
53- import { IgxTextSelectionModule } from '../directives/text-selection/text-selection.directive' ;
53+ import { IgxTextSelectionModule } from '../directives/text-selection/text-selection.directive' ;
5454
5555
5656let NEXT_ID = 0 ;
@@ -1945,7 +1945,11 @@ export class IgxTimePickerComponent implements
19451945
19461946 const oldVal = new Date ( this . value ) ;
19471947
1948- this . displayValue = '' ;
1948+ this . displayValue = this . parseMask ( false ) ;
1949+ requestAnimationFrame ( ( ) => {
1950+ this . _setCursorPosition ( 0 ) ;
1951+ } ) ;
1952+ // TODO: refactoring - this.value should be null #8135
19491953 this . value . setHours ( 0 , 0 ) ;
19501954
19511955 if ( oldVal . getTime ( ) !== this . value . getTime ( ) ) {
@@ -1964,33 +1968,34 @@ export class IgxTimePickerComponent implements
19641968 * @hidden
19651969 */
19661970 public onInput ( event ) : void {
1967- const val = event . target . value ;
1971+ const inputMask = event . target . value ;
19681972 const oldVal = new Date ( this . value ) ;
19691973
1970- this . isNotEmpty = val !== this . parseMask ( false ) ;
1974+ this . isNotEmpty = inputMask !== this . parseMask ( false ) ;
19711975
19721976 // handle cases where all empty positions (promts) are filled and we want to update
19731977 // timepicker own value property if it is a valid Date
1974- if ( val . indexOf ( this . promptChar ) === - 1 ) {
1975- if ( this . _isEntryValid ( val ) ) {
1976- const newVal = this . convertMinMaxValue ( val ) ;
1978+ if ( inputMask . indexOf ( this . promptChar ) === - 1 ) {
1979+ if ( this . _isEntryValid ( inputMask ) ) {
1980+ const newVal = this . convertMinMaxValue ( inputMask ) ;
19771981 if ( oldVal . getTime ( ) !== newVal . getTime ( ) ) {
19781982 this . value = newVal ;
19791983 }
19801984 } else {
19811985 const args : IgxTimePickerValidationFailedEventArgs = {
19821986 timePicker : this ,
1983- currentValue : val ,
1987+ currentValue : inputMask ,
19841988 setThroughUI : false
19851989 } ;
19861990 this . onValidationFailed . emit ( args ) ;
19871991 }
19881992 // handle cases where the user deletes the display value (when pressing backspace or delete)
1989- } else if ( ! this . value || ! val || val === this . parseMask ( false ) ) {
1993+ } else if ( inputMask === this . parseMask ( false ) ) {
19901994 this . isNotEmpty = false ;
19911995
1996+ // TODO: refactoring - this.value should be null #8135
19921997 this . value . setHours ( 0 , 0 ) ;
1993- this . displayValue = val ;
1998+ this . displayValue = inputMask ;
19941999
19952000 if ( oldVal . getTime ( ) !== this . value . getTime ( ) ) {
19962001 const args : IgxTimePickerValueChangedEventArgs = {
0 commit comments