diff --git a/src/core_modules/capture-core/components/FiltersForTypes/Date/DateFilter.component.js b/src/core_modules/capture-core/components/FiltersForTypes/Date/DateFilter.component.js index b106b539db..583a876cce 100644 --- a/src/core_modules/capture-core/components/FiltersForTypes/Date/DateFilter.component.js +++ b/src/core_modules/capture-core/components/FiltersForTypes/Date/DateFilter.component.js @@ -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: { @@ -177,9 +178,10 @@ class DateFilterPlain extends Component 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;