carbon-fields icon indicating copy to clipboard operation
carbon-fields copied to clipboard

date with custom format don't save value

Open fabienlege opened this issue 4 years ago • 1 comments

Version

  • Carbon Fields: 3.1.15
  • WordPress: 5.3.2
  • PHP: 7.2

Expected Behavior

Save the date with custom format

Actual Behavior

Date value don't be saved with custom format

Container definition

Container::make( 'post_meta', __( 'Coordonnées du contact', 'agenceho5' ) )
      ->where( 'post_type', '=', static::POST_TYPE )
      ->add_fields( [
        Field::make( 'text', 'email', __( 'Email', 'agenceho5' ) )->set_attribute( 'type', 'email' ),
        Field::make( 'text', 'phone1', __( 'Téléphone 1', 'agenceho5' ) ),
        ...
        Field::make( 'date', 'daterencontre', __( 'Date de première rencontre', 'agenceho5' ) )->set_picker_options( ['locale' => 'fr'] )->set_storage_format( 'Y-m-d' )->set_input_format( "Y-m-d", "d-m-Y" ),
        Field::make( 'textarea', 'note', __( 'Remarques', 'agenceho5' ) ),

      ] );

Steps to Reproduce the Problem

1.Create a field with a custom date format 2. Try to save a value to this field 3. Value of this field is empty

Comments

  • This problem seam to be revealed since 2 years ! (#561 )
  • Other related issue in CF doc : on this page https://docs.carbonfields.net/#/advanced-topics/wpml-support?id=flatpickr, 'carbon-fields-boot' identifier doesn't exist anymore, it's now 'carbon-fields-core'

fabienlege avatar Mar 28 '20 17:03 fabienlege

Same thing happens for the date_time field as well...

gnikolopoulos avatar Sep 08 '23 21:09 gnikolopoulos