From 45ef7b2f69d5091e7d391406780378730f9fd025 Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Mon, 3 Apr 2023 21:01:58 +0800 Subject: [PATCH] Fix Effective Date Range cannot be removed --- server/model/maintenance.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/server/model/maintenance.js b/server/model/maintenance.js index e3ce5d321..787953fb8 100644 --- a/server/model/maintenance.js +++ b/server/model/maintenance.js @@ -18,9 +18,12 @@ class Maintenance extends BeanModel { let dateRange = []; if (this.start_date) { dateRange.push(this.start_date); - if (this.end_date) { - dateRange.push(this.end_date); - } + } else { + dateRange.push(null); + } + + if (this.end_date) { + dateRange.push(this.end_date); } let timeRange = []; @@ -155,10 +158,14 @@ class Maintenance extends BeanModel { if (obj.dateRange[0]) { bean.start_date = obj.dateRange[0]; + } else { + bean.start_date = null; + } - if (obj.dateRange[1]) { - bean.end_date = obj.dateRange[1]; - } + if (obj.dateRange[1]) { + bean.end_date = obj.dateRange[1]; + } else { + bean.end_date = null; } if (bean.strategy === "cron") {