Fix date format interfering with month filter edit (#6497)

The month filter edit popup was always displaying dates in mm/yyyy format
regardless of user's date format preference. Now respects the configured
date format setting.

Fixes #6341
This commit is contained in:
Faizan Qureshi
2026-01-06 22:03:05 +05:30
committed by GitHub
parent fa45342d8d
commit 5f1c13e25c
2 changed files with 12 additions and 3 deletions

View File

@@ -91,6 +91,7 @@ function ConfigureField<T extends RuleConditionEntity>({
}: ConfigureFieldProps<T>) {
const { t } = useTranslation();
const format = useFormat();
const dateFormat = useDateFormat() || 'MM/dd/yyyy';
const [subfield, setSubfield] = useState(initialSubfield);
const inputRef = useRef<AmountInputRef>(null);
const prevOp = useRef<T['op'] | null>(null);
@@ -118,11 +119,13 @@ function ConfigureField<T extends RuleConditionEntity>({
typeof value === 'string' &&
/^\d{4}-\d{2}$/.test(value)
) {
const [year, month] = value.split('-');
return `${month}/${year}`;
const date = parseDate(value, 'yyyy-MM', new Date());
if (isDateValid(date)) {
return formatDate(date, getMonthYearFormat(dateFormat));
}
}
return value;
}, [value, field, subfield]);
}, [value, field, subfield, dateFormat]);
return (
<FocusScope>

View File

@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [Faizanq]
---
Fix month filter edit popup showing date in wrong format for non-default date formats.