@freezhao
Have you tried with this date format Y-m-d
https://www.php.net/manual/en/datetime.format.php
-
This reply was modified 3 years, 6 months ago by
missveronica.
-
This reply was modified 3 years, 6 months ago by
missveronica.
@missveronicatv hi
Thansk for you replay.
I have tried the update the format to Y-m-d
but in the front-end editing mode still show 1 Sep. 2013
https://tinyurl.com/2a4yazvs
@freezhao
Yes you are right, this is a JavaScript format for the meta_key birth_date in edit mode.
You can try this code snippet to force the JavaScript to use the PHP format Y-m-d
For other fields change birth_date to the desired meta_key name in the code snippet.
add_filter( "um_get_field__birth_date", 'um_get_field__birth_date_custom', 10, 1 );
function um_get_field__birth_date_custom( $array ) {
if( isset( $array['js_format'])) {
$array['js_format'] = 'yyyy-mm-dd';
}
return $array;
}
Install the code snippet into your active theme’s functions.php file
or use the “Code Snippets” plugin.
https://ww.wp.xz.cn/plugins/code-snippets/
-
This reply was modified 3 years, 6 months ago by
missveronica.
Thanks!the birth_date in editing mode in perfect.
One more question abou this:
I have a cunstomized date picker, the meta key is “class-date”.
Should I uset the code:
add_filter( "um_get_field__edu-year", 'um_get_field__edu-year_custom', 10, 1 );
function um_get_field__edu-year_custom( $array ) {
if( isset( $array['js_format'])) {
$array['js_format'] = 'yyyy-mm-dd';
}
return $array;
}
@freezhao
Yes, this should work for your customized date field.
I have posted an UM bug report about this YMD date issue.
https://github.com/ultimatemember/ultimatemember/issues/1096
I subscribed that issue
It’s pity that code does not work for the meta key “class-date”. It show valid at first line.
Hope UM will upgrade it.
And Thanks for you help @missveronicatv
Hi @freezhao
Has the above solution provided by Miss Veronica resolved the issue? If so, please kindly mark this thread as “Resolved.”
Thank you!