Date field, timestamp problem ?
- This topic has 10 replies, 4 voices, and was last updated 4 years, 1 month ago by
Alessandro Manias.
-
AuthorPosts
-
April 24, 2020 at 3:21 AM #19250
Julien
ParticipantHello,
I don't know when the problem occured but now, when I save post, the date fields are incorrect.
Example
array( 'name' => 'Date de début', 'id' => 'start_price_date', 'type' => 'date', 'timestamp' => true, ),
I can set date with the Datepicker but when post saved, the result is that one.
{"timestamp":"2020-04-16","formatted":"1970-01-01"}
I set April 16 2020, the values are incorrect and I have the Json in field.
Wordpress: 5.4
Metabox : 5.2.10
Metabox AIO : 1.11.5Can u replicate the problem ?
April 24, 2020 at 10:11 AM #19256Long Nguyen
ModeratorHi,
I've tested the field
Date
on my local site, it saves and displays the date (human-read) as well. Could you please deactivate all plugins except Meta Box plugins then check the problem again? If it still happens, please try to open the Console tab in Developer tool and let me know if there are any error notice.April 24, 2020 at 1:59 PM #19261Julien
ParticipantHello,
I debug a little "more" with a functional version, it doesn't work when I update meta box and meta box aio.
No error on console.
The meta are in custom post type "product" of Woocommerce plugin.
April 24, 2020 at 2:18 PM #19262Julien
ParticipantI made more test on a fresh install, the problem occured when field date is on "group".
$meta_boxes[] = array( 'title' => 'Hello World', 'post_types' => array( 'post', 'page' ), 'fields' => array( array( 'id' => 'my_group', // 'name' => 'My Group', 'type' => 'group', 'clone' => true, 'sort_clone' => true, 'fields' => [ array( 'name' => 'My Date', 'id' => 'my_date', 'type' => 'date', 'timestamp' => true, ), ] ), ) );
April 24, 2020 at 3:15 PM #19264Long Nguyen
ModeratorHi,
I'm going to check it out and let you know later.
Thank you.
April 24, 2020 at 11:27 PM #19279alpha.media
ParticipantI am also seeing a problem after updating Metabox and Metabox Group in the past few days. It's been a while since this feature has been coded so i'm not quite sure the problem but something is up with the latest release and the datetime field saving.
April 27, 2020 at 4:22 PM #19307Long Nguyen
ModeratorHi guys,
Please update the new version of MB AIO to v1.11.6 or MB Group to v1.3.10 then check this problem again. Let me know how it goes.
April 27, 2020 at 4:42 PM #19308Julien
ParticipantIt's seems to be fixed.
Thank you 😀
March 23, 2021 at 2:10 AM #26597Alessandro Manias
ParticipantHi, I had a similar problem when i try to save a post via the REST API.
The post is a custom post type with a type=date and timestamp=true.I've tried to POST the field with date "Y-m-d", date "d/m/Y", datetime "d/m/Y H:i:s", timestamp format but or it stay empty or it takes 1 and show First January 1970.
Config
MB Rest API 1.4.0
Meta Box 5.3.8
WP 5.5.3March 23, 2021 at 12:59 PM #26606Long Nguyen
ModeratorHi Alessandro,
Thanks for your feedback.
Updating the date field with the option
'timestamp' => true
via REST API seems not working. Please turn it off and re-update, I will inform the development team to check on this case.March 23, 2021 at 4:45 PM #26610Alessandro Manias
ParticipantHi,
I'd like to simply turn off but I can't because I use it to order and filter the custom post type on the front end.
If I turn off the option I will end with data of different nature that i can't cast to order and filter. By now to order and filter I use a cast to NUMBER in the WP WP_Query.
I will wait for a fix, I'm using this feature in a project I'm developing.
Do you have an estimation of the resolution time?
Thanks a lot.
Alessandro
-
AuthorPosts
- You must be logged in to reply to this topic.