Merged in bugfix/PMCORE-2704 (pull request #7743)
PMCORE-2704 Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
@@ -17,4 +17,16 @@ class ApplyMaskDateEnvironmentTest extends TestCase
|
||||
$expected = '2020/11/12';
|
||||
$this->assertEquals($expected, applyMaskDateEnvironment($date1, 'Y/m/d'));
|
||||
}
|
||||
|
||||
/**
|
||||
* When the mask is empty will return the same date
|
||||
*
|
||||
* @test
|
||||
*/
|
||||
public function it_should_return_date_without_mask()
|
||||
{
|
||||
$date1 = date("2020-11-12 09:09:10");
|
||||
$expected = '2020-11-12 09:09:10';
|
||||
$this->assertEquals($expected, applyMaskDateEnvironment($date1));
|
||||
}
|
||||
}
|
||||
@@ -617,7 +617,7 @@ function applyMaskDateEnvironment(string $date, $mask = '')
|
||||
$systemConf->loadConfig($obj, 'ENVIRONMENT_SETTINGS', '');
|
||||
$mask = isset($systemConf->aConfig['dateFormat']) ? $systemConf->aConfig['dateFormat'] : '';
|
||||
}
|
||||
if (!empty($date)) {
|
||||
if (!empty($date) && !empty($mask)) {
|
||||
$date = new DateTime($date);
|
||||
$result = $date->format($mask);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user