@@ -103,7 +103,6 @@ class DateBoxMask extends DateBoxBase {
103103 // @ts -expect-error
104104 const isNotDeletingInCalendar = this . option ( 'opened' ) && e && ! keysToHandleByMask . includes ( normalizeKeyName ( e ) ) ;
105105
106- // eslint-disable-next-line @typescript-eslint/prefer-optional-chain
107106 return ! this . _useMaskBehavior ( ) || isNotDeletingInCalendar || ( e && e . altKey ) ;
108107 }
109108
@@ -513,7 +512,7 @@ class DateBoxMask extends DateBoxBase {
513512 const limits = this . _getActivePartLimits ( ) ;
514513 const maxLimitLength = String ( limits . max ) . length ;
515514
516- // eslint-disable-next-line @typescript-eslint/prefer-optional-chain, @typescript-eslint/prefer- nullish-coalescing
515+ // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
517516 return ( ( zeroes && zeroes [ 0 ] || '' ) + String ( value ) ) . substr ( - maxLimitLength ) ;
518517 }
519518
@@ -533,7 +532,7 @@ class DateBoxMask extends DateBoxBase {
533532
534533 _getActivePartProp ( property ) {
535534 // @ts -expect-error ts-error
536- // eslint-disable-next-line @typescript-eslint/prefer-optional-chain
535+
537536 if ( ! this . _dateParts || ! this . _dateParts [ this . _activePartIndex ] ) {
538537 return undefined ;
539538 }
@@ -549,12 +548,16 @@ class DateBoxMask extends DateBoxBase {
549548 _saveMaskValue ( ) : void {
550549 const value = this . _maskValue && new Date ( this . _maskValue ) ;
551550 const { type } = this . option ( ) ;
551+
552552 if ( value && type === 'date' ) {
553553 value . setHours ( 0 , 0 , 0 , 0 ) ;
554554 }
555555 // @ts -expect-error ts-error
556556 this . _initialMaskValue = new Date ( value ) ;
557- this . dateOption ( 'value' , value ) ;
557+
558+ if ( this . _applyInternalValidation ( value ) . isValid ) {
559+ this . dateOption ( 'value' , value ) ;
560+ }
558561 }
559562
560563 _revertChanges ( ) : void {
@@ -640,7 +643,7 @@ class DateBoxMask extends DateBoxBase {
640643
641644 _isValueDirty ( ) {
642645 const value = this . dateOption ( 'value' ) ;
643- // eslint-disable-next-line @typescript-eslint/prefer-optional-chain
646+
644647 return ( this . _maskValue && this . _maskValue . getTime ( ) ) !== ( value && value . getTime ( ) ) ;
645648 }
646649
0 commit comments