Custom Fields
Re-Envisioned
Support General Date field, timestamp problem ?

  • Creator
    Topic
  • #19250
    Resolved Julien
    Participant

    Hello,

    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.5

    Can u replicate the problem ?

Viewing 10 replies - 1 through 10 (of 10 total)
  • Author
    Replies
  • #19256
    Long Nguyen
    Moderator

    Hi,

    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.

    #19261
    Julien
    Participant

    Hello,

    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.

    #19262
    Julien
    Participant

    I 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,
                        ),
                    ]
                ),
            )
        );
    #19264
    Long Nguyen
    Moderator

    Hi,

    I’m going to check it out and let you know later.

    Thank you.

    #19279
    alpha.media
    Participant

    I 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.

    #19307
    Long Nguyen
    Moderator

    Hi 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.

    #19308
    Julien
    Participant

    It’s seems to be fixed.

    Thank you 😀

    #26597
    Alessandro Manias
    Participant

    Hi, 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.3

    #26606
    Long Nguyen
    Moderator

    Hi 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.

    #26610
    Alessandro Manias
    Participant

    Hi,

    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

Viewing 10 replies - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.