fix: parseGroupDate now handles DD.MM.YYYY (4-digit year) format
customer_date in DB is stored as 23.06.2026 (DD.MM.YYYY) but parseGroupDate only matched DD.MM.YY (2-digit year). This caused date filter to reject all groups when filtering by date range, since parseGroupDate returned null for 4-digit year dates.
This commit is contained in:
parent
45dbbd4cb3
commit
bbe578eb3a
|
|
@ -207,6 +207,18 @@ export const parseGroupDate = (value) => {
|
|||
return new Date(Date.UTC(Number(`20${year}`), Number(month) - 1, Number(day)));
|
||||
}
|
||||
|
||||
const fullDateMatch = normalized.match(/^(\d{2})\.(\d{2})\.(\d{4})$/);
|
||||
if (fullDateMatch) {
|
||||
const [, day, month, year] = fullDateMatch;
|
||||
return new Date(Date.UTC(Number(year), Number(month) - 1, Number(day)));
|
||||
}
|
||||
|
||||
const dotSeparatedMatch = normalized.match(/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/);
|
||||
if (dotSeparatedMatch) {
|
||||
const [, day, month, year] = dotSeparatedMatch;
|
||||
return new Date(Date.UTC(Number(year), Number(month) - 1, Number(day)));
|
||||
}
|
||||
|
||||
const parsed = new Date(normalized);
|
||||
return Number.isNaN(parsed.getTime()) ? null : parsed;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue