diff options
Diffstat (limited to 'app/Helper')
-rw-r--r-- | app/Helper/Dt.php | 46 | ||||
-rw-r--r-- | app/Helper/Task.php | 5 |
2 files changed, 47 insertions, 4 deletions
diff --git a/app/Helper/Dt.php b/app/Helper/Dt.php index 78002b1b..eb3f93b3 100644 --- a/app/Helper/Dt.php +++ b/app/Helper/Dt.php @@ -13,6 +13,50 @@ use DateTime; class Dt extends \Kanboard\Core\Base { /** + * Get formatted time + * + * @access public + * @param integer $value + * @return string + */ + public function time($value) + { + return date($this->config->get('application_time_format', 'H:i'), $value); + } + + /** + * Get formatted date + * + * @access public + * @param integer $value + * @return string + */ + public function date($value) + { + if (empty($value)) { + return ''; + } + + if (! ctype_digit($value)) { + $value = strtotime($value); + } + + return date($this->config->get('application_date_format', 'm/d/Y'), $value); + } + + /** + * Get formatted datetime + * + * @access public + * @param integer $value + * @return string + */ + public function datetime($value) + { + return date($this->config->get('application_datetime_format', 'm/d/Y H:i'), $value); + } + + /** * Get duration in seconds into human format * * @access public @@ -107,6 +151,6 @@ class Dt extends \Kanboard\Core\Base */ public function getWeekDay($day) { - return dt('%A', strtotime('next Monday +'.($day - 1).' days')); + return date('l', strtotime('next Monday +'.($day - 1).' days')); } } diff --git a/app/Helper/Task.php b/app/Helper/Task.php index 0ef3da2c..e85d6e30 100644 --- a/app/Helper/Task.php +++ b/app/Helper/Task.php @@ -142,7 +142,7 @@ class Task extends Base public function selectStartDate(array $values, array $errors = array(), array $attributes = array()) { - $placeholder = $this->helper->text->in($this->config->get('application_date_format'), $this->dateParser->getAvailableFormats()); + $placeholder = date($this->config->get('application_date_format', 'm/d/Y H:i')); $attributes = array_merge(array('tabindex="11"', 'placeholder="'.$placeholder.'"'), $attributes); $html = $this->helper->form->label(t('Start Date'), 'date_started'); @@ -153,12 +153,11 @@ class Task extends Base public function selectDueDate(array $values, array $errors = array(), array $attributes = array()) { - $placeholder = $this->helper->text->in($this->config->get('application_date_format'), $this->dateParser->getAvailableFormats()); + $placeholder = date($this->config->get('application_date_format', 'm/d/Y')); $attributes = array_merge(array('tabindex="12"', 'placeholder="'.$placeholder.'"'), $attributes); $html = $this->helper->form->label(t('Due Date'), 'date_due'); $html .= $this->helper->form->text('date_due', $values, $errors, $attributes, 'form-date'); - $html .= '<div class="form-help">'.t('Others formats accepted: %s and %s', date('Y-m-d'), date('Y_m_d')).'</div>'; return $html; } |