Chinese character in date picker
- This topic has 9 replies, 2 voices, and was last updated 3 years, 10 months ago by
Long Nguyen.
-
AuthorPosts
-
June 16, 2021 at 5:32 PM #28940
chillifish
ParticipantThere is a Chinese character appearing in my datepicker. I'm not sure why this is… screenshot here.
June 16, 2021 at 10:20 PM #28946Long Nguyen
ModeratorHi,
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.June 16, 2021 at 10:36 PM #28947chillifish
ParticipantYou'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.
June 16, 2021 at 10:40 PM #28949chillifish
ParticipantThinking 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.
June 17, 2021 at 4:55 PM #28957chillifish
ParticipantAlso, 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.
June 17, 2021 at 4:56 PM #28958chillifish
ParticipantSettings 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', ),
June 22, 2021 at 12:51 AM #29049chillifish
ParticipantCan anyone help me with the Date Format issue? It's causing me real problems and I need to make the site live.
June 22, 2021 at 12:22 PM #29054Long Nguyen
ModeratorHi,
Can you please let me know which wrong with the setting
save_format
? The format of the date should bearray( '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
June 22, 2021 at 2:14 PM #29057chillifish
ParticipantHi, 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.June 23, 2021 at 7:43 AM #29074Long Nguyen
ModeratorHi,
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 -
AuthorPosts
- You must be logged in to reply to this topic.