mirror of
https://github.com/actualbudget/actual.git
synced 2026-03-11 20:44:32 -05:00
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:
@@ -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>
|
||||
|
||||
6
upcoming-release-notes/6497.md
Normal file
6
upcoming-release-notes/6497.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
category: Bugfix
|
||||
authors: [Faizanq]
|
||||
---
|
||||
|
||||
Fix month filter edit popup showing date in wrong format for non-default date formats.
|
||||
Reference in New Issue
Block a user