Skip to content

Commit

Permalink
fix: error is missing when the calendar is in the dd-MM-yyyy format.
Browse files Browse the repository at this point in the history
  • Loading branch information
alaa-yahia committed Nov 12, 2024
1 parent e315967 commit 240cd1d
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import './calendarFilterStyles.css';
import { mainOptionKeys, mainOptionTranslatedTexts } from './options';
import { getDateFilterData } from './dateFilterDataGetter';
import { RangeFilter } from './RangeFilter.component';
import { parseDate } from '../../../utils/converters/date';

const getStyles = (theme: Theme) => ({
fromToContainer: {
Expand Down Expand Up @@ -177,9 +178,10 @@ class DateFilterPlain extends Component<Props, State> implements UpdatableFilter
}

static isFromAfterTo(valueFrom: string, valueTo: string) {
const dateFrom = new Date(valueFrom);
const dateTo = new Date(valueTo);
return dateFrom > dateTo;
const momentFrom = parseDate(valueFrom).momentDate;
const momentTo = parseDate(valueTo).momentDate;
// $FlowFixMe[incompatible-use] automated comment
return momentFrom.isAfter(momentTo);
}

toD2DateTextFieldInstance: any;
Expand Down

0 comments on commit 240cd1d

Please sign in to comment.