Skip to content

Commit 037a051

Browse files
committed
MAGETWO-39201: Refactoring and UnitTest Coverage \Magento\Reports\Block\Adminhtml\Sales\Grid\Column\Renderer\Date
1 parent 117e2b9 commit 037a051

File tree

1 file changed

+13
-16
lines changed
  • app/code/Magento/Reports/Block/Adminhtml/Sales/Grid/Column/Renderer

1 file changed

+13
-16
lines changed

app/code/Magento/Reports/Block/Adminhtml/Sales/Grid/Column/Renderer/Date.php

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,19 @@ protected function _getFormat()
3535
{
3636
$format = $this->getColumn()->getFormat();
3737
if (!$format) {
38-
try {
39-
$dataBundle = new DataBundle();
40-
$resourceBundle = $dataBundle->get($this->_localeResolver->getLocale());
41-
$formats = $resourceBundle['calendar']['gregorian']['availableFormats'];
42-
switch ($this->getColumn()->getPeriodType()) {
43-
case 'month':
44-
$format = $formats['yM'];
45-
break;
46-
case 'year':
47-
$format = $formats['y'];
48-
break;
49-
default:
50-
$format = $this->_localeDate->getDateFormat(\IntlDateFormatter::MEDIUM);
51-
break;
52-
}
53-
} catch (\Exception $e) {
38+
$dataBundle = new DataBundle();
39+
$resourceBundle = $dataBundle->get($this->_localeResolver->getLocale());
40+
$formats = $resourceBundle['calendar']['gregorian']['availableFormats'];
41+
switch ($this->getColumn()->getPeriodType()) {
42+
case 'month':
43+
$format = $formats['yM'];
44+
break;
45+
case 'year':
46+
$format = $formats['y'];
47+
break;
48+
default:
49+
$format = $this->_localeDate->getDateFormat(\IntlDateFormatter::MEDIUM);
50+
break;
5451
}
5552
}
5653
return $format;

0 commit comments

Comments
 (0)