แก้วันที่มีผลคำสั่ง

This commit is contained in:
kittapath 2024-09-27 12:58:24 +07:00
parent d781920ad4
commit 71cfc78c6e

View file

@ -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";