diff options
author | Gerardo Zamudio <gerardozamudio@users.noreply.github.com> | 2016-02-24 23:48:50 -0600 |
---|---|---|
committer | Gerardo Zamudio <gerardozamudio@users.noreply.github.com> | 2016-02-24 23:48:50 -0600 |
commit | e4de6b3898b64b26d29aff31f21df5fda8055686 (patch) | |
tree | 575f8a65440f291d70a070d168eafca8c82a6459 /app/Helper/Dt.php | |
parent | d9ffbea174ea6524d0a22f8375ca8b3aa04a3c96 (diff) | |
parent | a6540bc604c837d92c9368540c145606723e97f7 (diff) |
Merge pull request #1 from fguillot/master
Update from upstream
Diffstat (limited to 'app/Helper/Dt.php')
-rw-r--r-- | app/Helper/Dt.php | 46 |
1 files changed, 45 insertions, 1 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')); } } |