Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix(crud): use 3-params overload for dates instead of separate assignments (#2894) (CP: 24.5) #2896

Merged
merged 1 commit into from
Nov 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions packages/ts/react-crud/src/locale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ export class LocaleFormatter {
if (typeof value === 'object') {
const { year, month, day } = value;
const date = new Date();
date.setFullYear(year);
date.setMonth(month);
date.setDate(day);
date.setFullYear(year, month, day);
return this.#date.format(date);
}

Expand Down Expand Up @@ -100,9 +98,7 @@ export class LocaleFormatter {

// Verify that the parsed date is valid
const dateInstance = new Date();
dateInstance.setFullYear(year);
dateInstance.setMonth(month);
dateInstance.setDate(day);
dateInstance.setFullYear(year, month, day);

if (dateInstance.getFullYear() !== year || dateInstance.getMonth() !== month || dateInstance.getDate() !== day) {
return undefined;
Expand Down