Lines Matching defs:date
65 // do some validation / conversion for date metadata
66 if (isset($data['date'])) {
67 if (is_array($data['date'])) {
68 foreach ($data['date'] as $key => $date) {
69 $date = $this->convertDate(trim($date));
70 if (!$date) {
71 unset($data['date'][$key]);
73 $data['date'][$key] = $date;
77 unset($data['date']);
82 $protected = array('description', 'date', 'contributor');
118 private function convertDate($date)
120 list($start, $end) = explode('->', $date, 2);
123 // single date
124 list($date, $time) = explode(' ', trim($start), 2);
125 if (!preg_match('/\d{4}\-\d{2}\-\d{2}/', $date)) {
129 return strtotime($date.' '.$time);
150 // only date given
171 private function autocompleteDate($date, $end=false)
173 if (!preg_match('/^\d{4}\-\d{2}\-\d{2}$/', $date)) {
174 if (preg_match('/^\d{4}\-\d{2}$/', $date)) {
176 return ($end) ? $date.'-28' : $date.'-01';
177 } elseif (preg_match('/^\d{4}$/', $date)) {
178 return ($end) ? $date.'-12-31' : $date.'-01-01';
183 return $date;