Skip to content

Commit

Permalink
refactor(kit): corrected review issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Belokopytov committed Nov 4, 2024
1 parent 68bbca7 commit d0d9e10
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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};
}
Expand All @@ -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),
};
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
});
});

Expand Down

0 comments on commit d0d9e10

Please sign in to comment.