htmlburger / carbon-fields

WordPress Custom Fields Library ✨
https://carbonfields.net/
Other
1.38k stars 245 forks source link

date with custom format don't save value #869

Open fabienlege opened 4 years ago

fabienlege commented 4 years ago

Version

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

  1. Try to save a value to this field
  2. Value of this field is empty

Comments

gnikolopoulos commented 1 year ago

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