Bug fixed, Date helper
This commit is contained in:
parent
cb557eb7c4
commit
29c44cdbe1
|
@ -30,7 +30,6 @@ define('PATH_BOOT', PATH_ROOT.'kernel'.DS.'boot'.DS);
|
||||||
// Init
|
// Init
|
||||||
require(PATH_BOOT.'init.php');
|
require(PATH_BOOT.'init.php');
|
||||||
|
|
||||||
|
|
||||||
// Admin area
|
// Admin area
|
||||||
if($Url->whereAmI()==='admin') {
|
if($Url->whereAmI()==='admin') {
|
||||||
require(PATH_BOOT.'admin.php');
|
require(PATH_BOOT.'admin.php');
|
||||||
|
|
|
@ -25,9 +25,14 @@ class Date {
|
||||||
// Format a local time/date according to locale settings.
|
// Format a local time/date according to locale settings.
|
||||||
public static function format($date, $currentFormat, $outputFormat)
|
public static function format($date, $currentFormat, $outputFormat)
|
||||||
{
|
{
|
||||||
|
// Returns a new DateTime instance or FALSE on failure.
|
||||||
$Date = DateTime::createFromFormat($currentFormat, $date);
|
$Date = DateTime::createFromFormat($currentFormat, $date);
|
||||||
|
|
||||||
return $Date->format($outputFormat);
|
if($Date!==false) {
|
||||||
|
return $Date->format($outputFormat);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function timeago($time)
|
public static function timeago($time)
|
||||||
|
|
|
@ -79,7 +79,7 @@ class Page extends fileContent
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the post date according to locale settings and format settings.
|
// Returns the post date according to locale settings and format settings.
|
||||||
public function date($format=false)
|
public function date()
|
||||||
{
|
{
|
||||||
return $this->getField('date');
|
return $this->getField('date');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue