@@ -63,7 +63,7 @@ public function getDataValue(DataField &$dataField, array $options){
6363 */
6464 public function setDataValue ($ input , DataField &$ dataField , array $ options ){
6565
66- $ format = DateFieldType::convertJavaDateFormat ($ options ['displayOptions ' ]['displayFormat ' ]);
66+ $ format = DateFieldType::convertJavascriptDateFormat ($ options ['displayOptions ' ]['displayFormat ' ]);
6767 if ($ options ['displayOptions ' ]['multidate ' ]){
6868 $ dates = explode (', ' , $ input );
6969 }
@@ -116,7 +116,10 @@ public function importData(DataField $dataField, $sourceArray, $isMigration) {
116116 foreach ($ sourceArray as $ idx => $ child ){
117117 $ dateObject = \DateTime::createFromFormat ($ format , $ child );
118118 if ($ dateObject ){
119- $ data [] = $ dateObject ->format (\DateTime::ISO8601 );
119+ $ data [] = $ dateObject ->format (\DateTime::ISO8601 );
120+ }
121+ else {
122+ $ dataField ->addMessage ("Bad date format: " .$ child );
120123 }
121124 }
122125 $ dataField ->setRawData ($ data );
@@ -176,6 +179,7 @@ public static function generateMapping(FieldType $current, $withPipeline){
176179 return [
177180 $ current ->getName () => array_merge ([
178181 "type " => "date " ,
182+ "format " => "date_time_no_millis " ,
179183 ], array_filter ($ current ->getMappingOptions ()))
180184 ];
181185 }
@@ -265,13 +269,13 @@ public function buildOptionsForm(FormBuilderInterface $builder, array $options)
265269 $ optionsForm = $ builder ->get ( 'options ' );
266270
267271 // String specific display options
268- // $optionsForm->get ( 'mappingOptions' )->add ( 'format', TextType::class, [
269- // 'required' => false,
270- // 'empty_data' => 'yyyy/MM/dd',
271- // 'attr' => [
272- // 'placeholder' => 'i.e. yyyy/MM/dd'
273- // ],
274- // ] );
272+ $ optionsForm ->get ( 'mappingOptions ' )->add ( 'format ' , TextType::class, [
273+ 'required ' => false ,
274+ 'empty_data ' => 'yyyy/MM/dd ' ,
275+ 'attr ' => [
276+ 'placeholder ' => 'i.e. yyyy/MM/dd '
277+ ],
278+ ] );
275279
276280 // String specific display options
277281 $ optionsForm ->get ( 'displayOptions ' )->add ( 'displayFormat ' , TextType::class, [
0 commit comments