Compare commits
No commits in common. "d55dee448b4e8e34ff79d3c5d2cc4b942f07e5b7" and "98a023190604bcb75c3ab7c1f096a33e85e2916e" have entirely different histories.
d55dee448b
...
98a0231906
@ -1,9 +1,9 @@
|
||||
import { Result } from "@repo/rdx-utils";
|
||||
import {
|
||||
DomainValidationError,
|
||||
ValidationErrorDetail,
|
||||
isDomainValidationError,
|
||||
isValidationErrorCollection,
|
||||
ValidationErrorDetail,
|
||||
} from "../errors";
|
||||
|
||||
/**
|
||||
@ -43,7 +43,7 @@ export function extractOrPushError<T>(
|
||||
error.details?.forEach((detail) => {
|
||||
errors.push({
|
||||
...detail,
|
||||
path: path ?? detail.path,
|
||||
path: detail.path ?? path,
|
||||
});
|
||||
});
|
||||
} else if (isDomainValidationError(error)) {
|
||||
|
||||
@ -9,8 +9,8 @@ export function translateZodValidationError<T>(
|
||||
const errors: ValidationErrorDetail[] = [];
|
||||
for (const issue of zodError.issues) {
|
||||
errors.push({
|
||||
message: `${message}: ${issue.message}`,
|
||||
path: issue.path ? issue.path.join(".") : undefined,
|
||||
message: issue.message,
|
||||
path: issue.path.join("."),
|
||||
value: errorValue ?? issue.input,
|
||||
});
|
||||
}
|
||||
|
||||
@ -42,19 +42,6 @@ export class UtcDate extends ValueObject<UtcDateProps> {
|
||||
return Result.ok(new UtcDate({ value: isoDateString }));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creador estático: devuelve la fecha de HOY en UTC a medianoche (00:00:00Z).
|
||||
* - Evita ambigüedades de zona horaria construyendo el ISO explícitamente.
|
||||
*/
|
||||
static today(): UtcDate {
|
||||
const now = new Date();
|
||||
const y = now.getUTCFullYear();
|
||||
const m = String(now.getUTCMonth() + 1).padStart(2, "0");
|
||||
const d = String(now.getUTCDate()).padStart(2, "0");
|
||||
const iso = `${y}-${m}-${d}T00:00:00Z`;
|
||||
return new UtcDate({ value: iso });
|
||||
}
|
||||
|
||||
getProps(): string {
|
||||
return this.props.value;
|
||||
}
|
||||
@ -70,7 +57,7 @@ export class UtcDate extends ValueObject<UtcDateProps> {
|
||||
* Devuelve la fecha en formato UTC sin hora (YYYY-MM-DD).
|
||||
*/
|
||||
toDateString(): string {
|
||||
return this.date.toISOString().split("T")[0] ?? "";
|
||||
return this.date.toISOString().split("T")[0];
|
||||
}
|
||||
|
||||
toString() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user