protected function didReadValueFromSavedQuery($value) { if (!$value) { return null; } if ($value instanceof AphrontFormDateControlValue && $value->getEpoch()) { return $value->setOptional(true); } $value = AphrontFormDateControlValue::newFromWild($this->getViewer(), $value); return $value->setOptional(true); }
private function getSafeDate($value) { $viewer = $this->requireViewer(); if ($value) { // ideally this would be consistent and always pass in the same type if ($value instanceof AphrontFormDateControlValue) { return $value; } else { $value = AphrontFormDateControlValue::newFromWild($viewer, $value); } } else { $value = AphrontFormDateControlValue::newFromEpoch($viewer, PhabricatorTime::getTodayMidnightDateTime($viewer)->format('U')); $value->setEnabled(false); } $value->setOptional(true); return $value; }