reduce config complexity by converting php format to js format (#734)

This commit is contained in:
Kevin Papst
2019-04-29 00:24:23 +02:00
committed by GitHub
parent 1b0b45649d
commit b8811924c3
7 changed files with 89 additions and 62 deletions

View File

@@ -9,12 +9,18 @@
namespace App\Configuration;
use App\Utils\MomentFormatConverter;
class LanguageFormattings
{
/**
* @var array
*/
protected $settings;
/**
* @var MomentFormatConverter
*/
protected $momentFormatter;
/**
* @param array $languageSettings
@@ -22,6 +28,7 @@ class LanguageFormattings
public function __construct(array $languageSettings)
{
$this->settings = $languageSettings;
$this->momentFormatter = new MomentFormatConverter();
}
/**
@@ -53,7 +60,7 @@ class LanguageFormattings
*/
public function getDatePickerFormat(string $locale): string
{
return $this->getConfig('date_picker', $locale);
return $this->momentFormatter->convert($this->getDateTypeFormat($locale));
}
/**
@@ -75,7 +82,7 @@ class LanguageFormattings
*/
public function getDateTimePickerFormat(string $locale): string
{
return $this->getConfig('date_time_picker', $locale);
return $this->momentFormatter->convert($this->getDateTimeTypeFormat($locale));
}
/**