Chinese character in date picker

Support General Chinese character in date picker

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #28940
    chillifishchillifish
    Participant

    There is a Chinese character appearing in my datepicker. I'm not sure why this is… screenshot here.

    #28946
    Long NguyenLong Nguyen
    Moderator

    Hi,

    It might relate to the language or a plugin activated on your site. Please go to Settings > General > Site language: English, deactivate all plugins except Meta Box, and re-check the issue.

    You can also share the JS options of the date field, I will test the options on my end.

    #28947
    chillifishchillifish
    Participant

    You're right, I should have checked plugins. It's clashing with the Formidable Forms plugin. When I disable that the colour of the datepicker changes and the whole thing looks smarter.

    #28949
    chillifishchillifish
    Participant

    Thinking about it, there's a datepicker form on that page, which is loading the preview text for the datepicker, so I guess that's where it's picking up the styling from.

    #28957
    chillifishchillifish
    Participant

    Also, it seems to be unrelated as it still happens with the formidable plugin deactivated, but the 'save_format' setting is being ignored. This is causing issues with date interpretations.

    #28958
    chillifishchillifish
    Participant

    Settings below:

    array(
        'name'            => esc_html__( 'To date', 'textdomain' ),
        'id'          => $prefix . 'to_date',
        'desc'            => esc_html__( 'End of date range', 'textdomain' ),
        'type'            => 'date',
         // Date picker options. See here http://api.jqueryui.com/datepicker
         'js_options' => array(
                            'dateFormat'  => 'dd/mm/yy',
                            'changeMonth' => true,
                            'changeYear'  => true,
                             ),
        'save_format' => 'yy-mm-dd',
    ),
    #29049
    chillifishchillifish
    Participant

    Can anyone help me with the Date Format issue? It's causing me real problems and I need to make the site live.

    #29054
    Long NguyenLong Nguyen
    Moderator

    Hi,

    Can you please let me know which wrong with the setting save_format? The format of the date should be

    array(
        'name'            => esc_html__( 'To date', 'textdomain' ),
        'id'          => $prefix . 'to_date',
        'desc'            => esc_html__( 'End of date range', 'textdomain' ),
        'type'            => 'date',
         // Date picker options. See here http://api.jqueryui.com/datepicker
         'js_options' => array(
                            'dateFormat'  => 'd/m/y',
                            'changeMonth' => true,
                            'changeYear'  => true,
                             ),
        'save_format' => 'Y-m-d',
    ),

    Get more details here https://www.w3schools.com/php/func_date_date_format.asp

    #29057
    chillifishchillifish
    Participant

    Hi, yes, the save_format is 'Y-m-d', but the date is being saved as d/m/y. This is causing an issue with strtotime on the front end.

    #29074
    Long NguyenLong Nguyen
    Moderator

    Hi,

    The function strtotime() parse the text date time to Unix timestamp. You can use the setting 'timestamp' => true to save the timestamp value to the database. Please get more details on the documentation https://docs.metabox.io/fields/datetime/#settings

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