Commit 230f40c8 by Vladimir Zbrailov

fix formatter

parent 84bfc3fc
...@@ -275,7 +275,7 @@ class Formatter extends Component ...@@ -275,7 +275,7 @@ class Formatter extends Component
return $this->nullDisplay; return $this->nullDisplay;
} }
$value = $this->normalizeDatetimeValue($value); $value = $this->normalizeDatetimeValue($value);
return $this->formatTimestamp($value, $format); return $this->formatTimestamp($value, $format === null ? $this->dateFormat : $format, $value);
} }
/** /**
...@@ -299,7 +299,7 @@ class Formatter extends Component ...@@ -299,7 +299,7 @@ class Formatter extends Component
return $this->nullDisplay; return $this->nullDisplay;
} }
$value = $this->normalizeDatetimeValue($value); $value = $this->normalizeDatetimeValue($value);
return $this->formatTimestamp($value, $format); return $this->formatTimestamp($value, $format === null ? $this->timeFormat : $format, $value);
} }
/** /**
...@@ -323,7 +323,7 @@ class Formatter extends Component ...@@ -323,7 +323,7 @@ class Formatter extends Component
return $this->nullDisplay; return $this->nullDisplay;
} }
$value = $this->normalizeDatetimeValue($value); $value = $this->normalizeDatetimeValue($value);
return $this->formatTimestamp($value, $format); return $this->formatTimestamp($value, $format === null ? $this->datetimeFormat : $format, $value);
} }
/** /**
...@@ -347,12 +347,12 @@ class Formatter extends Component ...@@ -347,12 +347,12 @@ class Formatter extends Component
* @param string $format the format used to convert the value into a date string. * @param string $format the format used to convert the value into a date string.
* @return string the formatted result * @return string the formatted result
*/ */
protected function formatTimestamp($value, $format = null) protected function formatTimestamp($value, $format)
{ {
$date = new DateTime(); $date = new DateTime();
$date->setTimestamp($value); $date->setTimestamp($value);
$date->setTimezone($this->timeZone); $date->setTimezone($this->timeZone);
return $date->format($format === null ? $this->datetimeFormat : $format); return $date->format($format);
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment