diff --git a/module/task/tao.php b/module/task/tao.php index 82ad882281..33826918ba 100644 --- a/module/task/tao.php +++ b/module/task/tao.php @@ -511,6 +511,23 @@ class taskTao extends taskModel return (string)$value; } + /** + * Format the task with valid datetime that set the zero date or datetime to null. + * + * @param object $task + * @return object + */ + protected function formatDatetime(object $task): object + { + if(empty($task)) return $task; + foreach($task as $key => $value) + { + if(!in_array($key, array('deadline', 'openedDate', 'assignedDate', 'estStarted', 'realStarted', 'finishedDate', 'canceledDate', 'closedDate', 'lastEditedDate', 'activatedDate'))) continue; + if(!empty($value) && is_string($value) && helper::isZeroDate($value)) $task->$key = null; + } + return $task; + } + /** * 获取执行下的任务。 * Fetch tasks under execution by executionID(Todo).