Skip to content

Commit

Permalink
Merge pull request #47 from bwaidelich/bugfix-respect-datepicker-date…
Browse files Browse the repository at this point in the history
…format

BUGFIX: Respect custom date formats in the DatePicker
  • Loading branch information
kdambekalns committed Jul 26, 2017
2 parents 44fc808 + 4a36f6f commit e7beeae
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Classes/FormElements/DatePicker.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
* source code.
*/

use Neos\Flow\Annotations as Flow;
use Neos\Flow\Property\PropertyMappingConfiguration;
use Neos\Flow\Property\TypeConverter\DateTimeConverter;

/**
* A date picker form element
Expand All @@ -25,4 +26,15 @@ public function initializeFormElement()
{
$this->setDataType('DateTime');
}

public function onSubmit(\Neos\Form\Core\Runtime\FormRuntime $formRuntime, &$elementValue)
{
if (!isset($this->properties['dateFormat'])) {
return;
}
/** @var PropertyMappingConfiguration $propertyMappingConfiguration */
$propertyMappingConfiguration = $this->getRootForm()->getProcessingRule($this->getIdentifier())->getPropertyMappingConfiguration();

$propertyMappingConfiguration->setTypeConverterOption(DateTimeConverter::class, DateTimeConverter::CONFIGURATION_DATE_FORMAT, $this->properties['dateFormat']);
}
}

0 comments on commit e7beeae

Please sign in to comment.