Skip to content

Commit

Permalink
chore(kit): InputDate use activeItem to check
Browse files Browse the repository at this point in the history
  • Loading branch information
mdlufy committed Nov 3, 2024
1 parent 52c1492 commit e44dbf1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 0 additions & 1 deletion projects/core/constants/regexp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ export const TUI_MASK_SYMBOLS_REGEXP = /[ \-_()]/g;
export const TUI_LAST_PUNCTUATION_MARK_REGEXP = /[.,\\/#!$%\\^&\\*;:{}=\\-_`~()]$/;
export const TUI_LATIN_REGEXP = /[A-z]/;
export const TUI_LATIN_AND_NUMBERS_REGEXP = /[A-z|0-9]/;
export const TUI_LETTER_REGEXP = /\p{L}/u;
7 changes: 5 additions & 2 deletions projects/kit/components/input-date/input-date.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ import {
import {
TUI_DEFAULT_MARKER_HANDLER,
TUI_DROPDOWN_COMPONENT,
TUI_LETTER_REGEXP,
TUI_TEXTFIELD_SIZE,
TuiMarkerHandler,
TuiPrimitiveTextfieldComponent,
Expand Down Expand Up @@ -296,8 +295,12 @@ export class TuiInputDateComponent
this.onOpenChange(true);
}

if (this.activeItem) {
this.nativeValue = '';
}

this.value =
value.length !== DATE_FILLER_LENGTH || TUI_LETTER_REGEXP.test(value)
value.length !== DATE_FILLER_LENGTH || this.activeItem
? null
: TuiDay.normalizeParse(value, this.dateFormat);
}
Expand Down

0 comments on commit e44dbf1

Please sign in to comment.