From 71cfc78c6e29af1f577caaa820289fd0b6de4052 Mon Sep 17 00:00:00 2001 From: kittapath Date: Fri, 27 Sep 2024 12:58:24 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=E0=B8=A7=E0=B8=B1?= =?UTF-8?q?=E0=B8=99=E0=B8=97=E0=B8=B5=E0=B9=88=E0=B8=A1=E0=B8=B5=E0=B8=9C?= =?UTF-8?q?=E0=B8=A5=E0=B8=84=E0=B8=B3=E0=B8=AA=E0=B8=B1=E0=B9=88=E0=B8=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/CommandController.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/controllers/CommandController.ts b/src/controllers/CommandController.ts index c7ce311b..f48ac65b 100644 --- a/src/controllers/CommandController.ts +++ b/src/controllers/CommandController.ts @@ -893,7 +893,16 @@ export class CommandController extends Controller { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลคำสั่งนี้"); } command.isSign = true; - if (new Date().getDate() > command.commandExcecuteDate.getDate()) { + if (command.commandExcecuteDate == null) + throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบวันที่คำสั่งมีผล"); + if ( + new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate()) < + new Date( + command.commandExcecuteDate.getFullYear(), + command.commandExcecuteDate.getMonth(), + command.commandExcecuteDate.getDate(), + ) + ) { command.status = "WAITING"; } else { command.status = "REPORTED";