diff --git a/src/components/tasks/AutomatedTaskForm.vue b/src/components/tasks/AutomatedTaskForm.vue index 21b21ed..bc9e3d5 100644 --- a/src/components/tasks/AutomatedTaskForm.vue +++ b/src/components/tasks/AutomatedTaskForm.vue @@ -838,9 +838,9 @@ export default { : []; // remove milliseconds and Z to work with native date input - task.value.run_time_date = formatDateInputField(task.value.run_time_date); + task.value.run_time_date = formatDateInputField(task.value.run_time_date, true); - if (task.value.expire_date) task.value.expire_date = formatDateInputField(task.value.expire_date); + if (task.value.expire_date) task.value.expire_date = formatDateInputField(task.value.expire_date, true); // set task type if monthlydow is being used if (task.value.task_type === "monthlydow") { diff --git a/src/utils/format.js b/src/utils/format.js index 34c203b..d38c235 100644 --- a/src/utils/format.js +++ b/src/utils/format.js @@ -226,7 +226,10 @@ export function getNextAgentUpdateTime() { } // converts a date with timezone to local for html native datetime fields -> YYYY-MM-DD HH:mm:ss -export function formatDateInputField(isoDateString) { +export function formatDateInputField(isoDateString, noTimezone = false) { + if (noTimezone) { + isoDateString = isoDateString.replace("Z", "") + } return date.formatDate(isoDateString, "YYYY-MM-DDTHH:mm:ss") }