From c68835baaf04a990351680672c289315cc2fb13a Mon Sep 17 00:00:00 2001 From: Georgy Pliev Date: Tue, 4 Aug 2026 17:59:14 +0300 Subject: [PATCH] fix: define error timestamps as ISO datetimes --- src/common/utils/startup-app/extra-models.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/common/utils/startup-app/extra-models.ts b/src/common/utils/startup-app/extra-models.ts index 6c4848cb..e7daf3bb 100644 --- a/src/common/utils/startup-app/extra-models.ts +++ b/src/common/utils/startup-app/extra-models.ts @@ -51,7 +51,9 @@ const internalServerErrors = Object.values(ERRORS).filter( export class RemnawaveNotFoundErrorDto extends createZodDto( z.object({ - timestamp: z.string().describe('Time when the error occurred, in ISO 8601 format.'), + timestamp: z.iso + .datetime({ local: true, offset: true }) + .describe('Time when the error occurred, in ISO 8601 format.'), path: z.string().describe('Path of the request that caused the error.'), message: z .enum(notFoundErrors.map((error) => error.message) as [string, ...string[]]) @@ -70,7 +72,9 @@ export class RemnawaveNotFoundErrorDto extends createZodDto( export class RemnawaveBadRequestErrorDto extends createZodDto( z.object({ - timestamp: z.string().describe('Time when the error occurred, in ISO 8601 format.'), + timestamp: z.iso + .datetime({ local: true, offset: true }) + .describe('Time when the error occurred, in ISO 8601 format.'), path: z.string().describe('Path of the request that caused the error.'), message: z .enum(badRequestErrors.map((error) => error.message) as [string, ...string[]]) @@ -106,7 +110,9 @@ export class RemnawaveValidationErrorDto extends createZodDto( export class RemnawaveInternalServerErrorDto extends createZodDto( z.object({ - timestamp: z.string().describe('Time when the error occurred, in ISO 8601 format.'), + timestamp: z.iso + .datetime({ local: true, offset: true }) + .describe('Time when the error occurred, in ISO 8601 format.'), path: z.string().describe('Path of the request that caused the error.'), message: z .enum(internalServerErrors.map((error) => error.message) as [string, ...string[]])