configure am/pm time-format as user preference (#2789)
This commit is contained in:
@@ -28,61 +28,50 @@ class LocaleFormatsTest extends TestCase
|
||||
{
|
||||
return [
|
||||
'de' => [
|
||||
'date_time_type' => 'dd.MM.yyyy HH:mm',
|
||||
'date_type' => 'dd.MM.yyyy',
|
||||
'date' => 'd.m.Y',
|
||||
'date_time' => 'd.m. H:i',
|
||||
'duration' => '%h:%m h',
|
||||
'time' => 'H:i',
|
||||
'24_hours' => true,
|
||||
],
|
||||
'en' => [
|
||||
'date_time_type' => 'yyyy-MM-dd HH:mm',
|
||||
'date_type' => 'yyyy-MM-dd',
|
||||
'date' => 'Y-m-d',
|
||||
'date_time' => 'm-d H:i',
|
||||
'duration' => '%h:%m h',
|
||||
'time' => 'H:i:s',
|
||||
'24_hours' => false,
|
||||
],
|
||||
'pt_BR' => [
|
||||
'date_time_type' => 'dd-MM-yyyy HH:mm',
|
||||
'date_type' => 'dd-MM-yyyy',
|
||||
'date' => 'd-m-Y',
|
||||
'duration' => '%h:%m h',
|
||||
],
|
||||
'it' => [
|
||||
'date_time_type' => 'dd.MM.yyyy HH:mm',
|
||||
'date_type' => 'dd.MM.yyyy',
|
||||
'date' => 'd.m.Y',
|
||||
'duration' => '%h:%m h',
|
||||
],
|
||||
'fr' => [
|
||||
'date_time_type' => 'dd/MM/yyyy HH:mm',
|
||||
'date_type' => 'dd/MM/yyyy',
|
||||
'date' => 'd/m/Y',
|
||||
'duration' => '%h h %m',
|
||||
],
|
||||
'es' => [
|
||||
'date_time_type' => 'dd.MM.yyyy HH:mm',
|
||||
'date_type' => 'dd.MM.yyyy',
|
||||
'date' => 'd.m.Y',
|
||||
'duration' => '%h:%m h',
|
||||
],
|
||||
'ru' => [
|
||||
'date_time_type' => 'dd.MM.yyyy HH:mm',
|
||||
'date_type' => 'dd.MM.yyyy',
|
||||
'date' => 'd.m.Y',
|
||||
'duration' => '%h:%m h',
|
||||
],
|
||||
'ar' => [
|
||||
'date_time_type' => 'yyyy-MM-dd HH:mm',
|
||||
'date_type' => 'yyyy-MM-dd',
|
||||
'date' => 'Y-m-d',
|
||||
'duration' => '%h:%m h',
|
||||
],
|
||||
'hu' => [
|
||||
'date_time_type' => 'yyyy.MM.dd HH:mm',
|
||||
'date_type' => 'yyyy.MM.dd',
|
||||
'date' => 'Y.m.d.',
|
||||
'duration' => '%h:%m h',
|
||||
@@ -160,32 +149,9 @@ class LocaleFormatsTest extends TestCase
|
||||
$this->assertEquals('yyyy-MM-dd HH:mm', $sut->getDateTimeTypeFormat());
|
||||
}
|
||||
|
||||
public function testGetDateTimePickerFormat()
|
||||
{
|
||||
$sut = $this->getSut('en', $this->getDefaultSettings());
|
||||
$this->assertEquals('YYYY-MM-DD HH:mm', $sut->getDateTimePickerFormat());
|
||||
}
|
||||
|
||||
public function testIs24Hours()
|
||||
{
|
||||
$sut = $this->getSut('en', $this->getDefaultSettings());
|
||||
$this->assertFalse($sut->isTwentyFourHours());
|
||||
}
|
||||
|
||||
public function testGetTimeFormat()
|
||||
{
|
||||
$sut = $this->getSut('en', $this->getDefaultSettings());
|
||||
$this->assertEquals('H:i:s', $sut->getTimeFormat());
|
||||
}
|
||||
|
||||
public function testUnknownSetting()
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage('Unknown setting for locale en: date_time_type');
|
||||
|
||||
$sut = $this->getSut('en', ['en' => [
|
||||
'xxx' => 'dd.MM.yyyy HH:mm',
|
||||
]]);
|
||||
$sut->getDateTimePickerFormat();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user