mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-06 16:07:18 +08:00
@ -4,6 +4,7 @@ Yii Framework 2 Change Log
|
|||||||
2.0.0-rc under development
|
2.0.0-rc under development
|
||||||
--------------------------
|
--------------------------
|
||||||
|
|
||||||
|
- Bug #3194: Date formatter works only for timestamps in the year range 1970 to 2038.
|
||||||
- Bug #2563: Theming is not working if the path map of the theme contains ".." or "." in the paths (qiangxue)
|
- Bug #2563: Theming is not working if the path map of the theme contains ".." or "." in the paths (qiangxue)
|
||||||
- Bug #2801: Fixed the issue that GridView gets footer content before data cells content (ElisDN)
|
- Bug #2801: Fixed the issue that GridView gets footer content before data cells content (ElisDN)
|
||||||
- Bug #3042: `yii\widgets\Pjax` should end application right after it finishes responding to a pjax request (qiangxue)
|
- Bug #3042: `yii\widgets\Pjax` should end application right after it finishes responding to a pjax request (qiangxue)
|
||||||
|
|||||||
@ -342,18 +342,24 @@ class Formatter extends Component
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Normalizes the given datetime value as one that can be taken by various date/time formatting methods.
|
* Normalizes the given datetime value as one that can be taken by various date/time formatting methods.
|
||||||
|
*
|
||||||
* @param mixed $value the datetime value to be normalized.
|
* @param mixed $value the datetime value to be normalized.
|
||||||
* @return integer the normalized datetime value
|
* @return integer the normalized datetime value
|
||||||
*/
|
*/
|
||||||
protected function normalizeDatetimeValue($value)
|
protected function normalizeDatetimeValue($value)
|
||||||
{
|
{
|
||||||
if (is_string($value)) {
|
if (is_string($value)) {
|
||||||
return is_numeric($value) || $value === '' ? (int) $value : strtotime($value);
|
if (is_numeric($value) || $value === '') {
|
||||||
} elseif ($value instanceof DateTime || $value instanceof \DateTimeInterface) {
|
$value = (double)$value;
|
||||||
/** @var $value \DateTimeInterface */
|
|
||||||
return $value->getTimestamp();
|
|
||||||
} else {
|
} else {
|
||||||
return (int) $value;
|
$date = new DateTime($value);
|
||||||
|
$value = $date->format('U');
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
} elseif ($value instanceof DateTime || $value instanceof \DateTimeInterface) {
|
||||||
|
return $value->format('U');
|
||||||
|
} else {
|
||||||
|
return (double)$value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user