Datepicker date format problem
Closed this issue · 3 comments
maks-rafalko commented
Seems like it's impossible to set format as the following: mm/dd/yy
.
Could you give an example hot to set this format?
This code does not work.
->add(
'owner_dob',
'genemu_jquerydate',
[
'widget' => 'single_text',
'label' => 'object.owner_dob.label',
'attr' => ['class' => 'form-text form-date-input'],
'configs' => [
'format' => 'mm/dd/yy',
'changeMonth' => true,
'changeYear' => true,
'maxDate' => 0,
]
]
)
sadleon commented
try dateFormat instead of format
maks-rafalko commented
hi @middlenight
dateFormat
is a setting for DatePicker
, but bundle uses format
key.
Please see: https://github.com/genemu/GenemuFormBundle/blob/master/Form/JQuery/Type/DateType.php#L48-L65
maks-rafalko commented
It was my mistake, format
should be at the root of array, not in configs
. Here is a working code:
->add(
'owner_dob',
'genemu_jquerydate',
[
'widget' => 'single_text',
'label' => 'object.owner_dob.label',
'attr' => ['class' => 'form-text form-date-input'],
'format' => 'dd/MM/yyyy',
'configs' => [
'changeMonth' => true,
'changeYear' => true,
'maxDate' => 0,
]
]
)