Ignore timezone when editing automated tasks

This commit is contained in:
sadnub
2022-04-25 14:17:57 -04:00
parent a754d94c2c
commit f7eca8aee0
2 changed files with 6 additions and 3 deletions

View File

@@ -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") {

View File

@@ -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")
}