From 2295cd3266903f98106a387005276e4666f1c729 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Fri, 4 Mar 2022 09:47:46 -0500 Subject: [PATCH] parse incoming JSON date strings as Date objects (#500) * parse incoming JSON date strings as Date objects * update create command too --- src/commands/send/create.command.ts | 2 ++ src/commands/send/edit.command.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/commands/send/create.command.ts b/src/commands/send/create.command.ts index 365a97ffea..bbf0adc65a 100644 --- a/src/commands/send/create.command.ts +++ b/src/commands/send/create.command.ts @@ -31,6 +31,8 @@ export class SendCreateCommand { if (typeof requestJson !== "string") { req = requestJson; + req.deletionDate = req.deletionDate == null ? null : new Date(req.deletionDate); + req.expirationDate = req.expirationDate == null ? null : new Date(req.expirationDate); } else { try { const reqJson = Buffer.from(requestJson, "base64").toString(); diff --git a/src/commands/send/edit.command.ts b/src/commands/send/edit.command.ts index 777d5674d1..4aac124079 100644 --- a/src/commands/send/edit.command.ts +++ b/src/commands/send/edit.command.ts @@ -27,6 +27,8 @@ export class SendEditCommand { let req: SendResponse = null; if (typeof requestJson !== "string") { req = requestJson; + req.deletionDate = req.deletionDate == null ? null : new Date(req.deletionDate); + req.expirationDate = req.expirationDate == null ? null : new Date(req.expirationDate); } else { try { const reqJson = Buffer.from(requestJson, "base64").toString();