diff --git a/projects/kit/src/lib/processors/normalize-date-preprocessor.ts b/projects/kit/src/lib/processors/normalize-date-preprocessor.ts index 760815320..aae026978 100644 --- a/projects/kit/src/lib/processors/normalize-date-preprocessor.ts +++ b/projects/kit/src/lib/processors/normalize-date-preprocessor.ts @@ -23,10 +23,6 @@ export function normalizeDatePreprocessor({ includesTime ? templateSegments.length : Infinity, ); - const timeSegments = dateTimeSegments.slice( - includesTime ? templateSegments.length : Infinity, - ); - if (!dateSegments.length || dateSegments.length % templateSegments.length !== 0) { return {elementState, data}; } @@ -51,7 +47,7 @@ export function normalizeDatePreprocessor({ return { elementState, data: includesTime - ? `${dates[0]}${dateTimeSeparator}${timeSegments.join(':')}` + ? `${dates[0]}${data.slice(data.indexOf(dateTimeSeparator))}` : dates.join(rangeSeparator), }; }; diff --git a/projects/kit/src/lib/processors/tests/normalize-date-preprocessor.spec.ts b/projects/kit/src/lib/processors/tests/normalize-date-preprocessor.spec.ts index 32f952e9a..f126206be 100644 --- a/projects/kit/src/lib/processors/tests/normalize-date-preprocessor.spec.ts +++ b/projects/kit/src/lib/processors/tests/normalize-date-preprocessor.spec.ts @@ -98,6 +98,14 @@ describe('normalizeDatePreprocessor', () => { it('empty input => 6.2.2023', () => { check('6.2.2022, 15', '06.02.2022, 15'); }); + + it('empty input => 6.2.2023, 12:01.001', () => { + check('6.2.2023, 12:01.001', '06.02.2023, 12:01.001'); + }); + + it('empty input => 6.2.2023, 01.001', () => { + check('6.2.2023, 01.001', '06.02.2023, 01.001'); + }); }); });