From 29c44cdbe1c4ecaa340c4698b2099c741167379c Mon Sep 17 00:00:00 2001 From: dignajar Date: Mon, 30 Nov 2015 20:07:06 -0300 Subject: [PATCH] Bug fixed, Date helper --- index.php | 1 - kernel/helpers/date.class.php | 7 ++++++- kernel/page.class.php | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/index.php b/index.php index 946df0ba..ed52b50e 100644 --- a/index.php +++ b/index.php @@ -30,7 +30,6 @@ define('PATH_BOOT', PATH_ROOT.'kernel'.DS.'boot'.DS); // Init require(PATH_BOOT.'init.php'); - // Admin area if($Url->whereAmI()==='admin') { require(PATH_BOOT.'admin.php'); diff --git a/kernel/helpers/date.class.php b/kernel/helpers/date.class.php index 1a9923a8..b817c5c7 100644 --- a/kernel/helpers/date.class.php +++ b/kernel/helpers/date.class.php @@ -25,9 +25,14 @@ class Date { // Format a local time/date according to locale settings. public static function format($date, $currentFormat, $outputFormat) { + // Returns a new DateTime instance or FALSE on failure. $Date = DateTime::createFromFormat($currentFormat, $date); - return $Date->format($outputFormat); + if($Date!==false) { + return $Date->format($outputFormat); + } + + return false; } public static function timeago($time) diff --git a/kernel/page.class.php b/kernel/page.class.php index c47638f9..94288fcb 100644 --- a/kernel/page.class.php +++ b/kernel/page.class.php @@ -79,7 +79,7 @@ class Page extends fileContent } // Returns the post date according to locale settings and format settings. - public function date($format=false) + public function date() { return $this->getField('date'); }