+ Add a function to set the zero date or datetime of the task to null.

This commit is contained in:
dingguodong
2023-08-18 09:47:13 +08:00
parent 608e6b8e40
commit 8cd201fe9b
+17
View File
@@ -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).