Hi!
I have clonable group defined:
'fields' => array(
array(
'id' => 'recurring_event_group',
'type' => 'group',
'clone' => true,
'collapsible' => false,
'add_button' => 'Add more',
'group_title' => 'Times',
'save_state' => true,
'sort_clone' => false,
'fields' => array(
array(
'id' => 'event_date',
'name' => 'Date start',
'desc' => '',
'type' => 'date',
// Date picker options. See here http://api.jqueryui.com/datepicker
'js_options' => array(
'dateFormat' => 'dd-mm-yy',
'showButtonPanel' => false,
),
// Save value as timestamp
'timestamp' => true,
'required' => true,
),
I programmatically adding to the group values right after creating a new post with wp_insert_post:
$recurring_events[] = array(
'event_date' => strtotime($start_date),
...
rwmb_set_meta( $new_post_id, 'recurring_event_group', $recurring_events );
When then viewing the newly created post on admin side the date field has correctly the date. But when viewing the frontend the date is shown as 1.1.1970.
If then clicking Save from the (Gutenberg) admin the frontend shows the date correctly after the save.
What causes this that the date timestamp value is not saved even though it is shown correctly on admin side in the date field? Is there a way to fix this so that there is not need to save the post from admin side?
Thanks!