Skip to content

Commit

Permalink
[Sanitization] Parse lastReviewed as a date
Browse files Browse the repository at this point in the history
  • Loading branch information
dchege711 committed Jul 14, 2024
1 parent 0d19a1f commit 0d5f2af
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/models/SanitizationAndValidation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ describe("Input Parsing", function() {
});
expect(data, error?.message).to.deep.equal({
_id: "5f5b6c3e4b4f3c0020b7f3c0",
lastReviewed,
lastReviewed: new Date(lastReviewed),
});
});

Expand Down
2 changes: 1 addition & 1 deletion src/models/SanitizationAndValidation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export const partialCardValidator = z.object({
tags: commaDelimitedStrings.optional(),
urgency: z.number().nonnegative().finite().optional(),
isPublic: z.boolean().optional(),
lastReviewed: z.string().datetime().optional(),
lastReviewed: z.coerce.date().optional(),
parent: z.string().refine(isMongoId, {
message: "Invalid card ID",
}).optional(),
Expand Down

0 comments on commit 0d5f2af

Please sign in to comment.