Skip to content

Commit

Permalink
fix: datepicker issue changes on isValid
Browse files Browse the repository at this point in the history
  • Loading branch information
harshith-venkatesh-freshworks committed Nov 13, 2024
1 parent 4110887 commit d077d85
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/crayons-core/src/components/datepicker/datepicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ const parse = (value, displayFormat, date, langModule) => {
return parseDate(value, displayFormat, date, langModule);
};

const isMatch = (value, displayFormat, langModule) => {
const isNoMatch = (value, displayFormat, langModule) => {
return (
langModule?.locale?.code !== 'is' &&
parseIsMatch(value, displayFormat, langModule)
!parseIsMatch(value, displayFormat, langModule)
);
};

Expand Down Expand Up @@ -937,10 +937,10 @@ export class Datepicker {
if (
!isValidFromDate ||
!isValidToDate ||
!isMatch(fromDate, this.displayFormat, {
isNoMatch(fromDate, this.displayFormat, {
locale: this.langModule,
}) ||
!isMatch(toDate, this.displayFormat, {
isNoMatch(toDate, this.displayFormat, {
locale: this.langModule,
}) ||
year < this.minYear ||
Expand Down Expand Up @@ -1029,8 +1029,8 @@ export class Datepicker {
if (
year < this.minYear ||
year > this.maxYear ||
(this.langModule.code !== 'is' && !isValid(parsedDate)) ||
!isMatch(val, this.displayFormat, {
!isValid(parsedDate) ||
isNoMatch(val, this.displayFormat, {
locale: this.langModule,
}) ||
!this.isDateWithinMinMaxDate(parsedDate.valueOf(), false)
Expand Down

0 comments on commit d077d85

Please sign in to comment.