Make WordPress Core

Opened 9 months ago

Last modified 9 months ago

#59423 new defect (bug)

Datepicker in wordpress do not follow the Date format set in the settings

Reported by: rajeshsingh520's profile rajeshsingh520 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: External Libraries Keywords: reporter-feedback
Focuses: ui, javascript Cc:


Go to wordpress > Settings > General

over there select "Date Format" > "Custom date" and set it to "jS F Y"

Once you do this it will show you date to be like this 21st September 2023

Now Add the below code in your theme function.php file this code will create a shortcode [datepicker]

function enqueue_datepicker_20230921() {
    wp_enqueue_style('jquery-ui-datepicker-style', '');

add_action('wp_enqueue_scripts', 'enqueue_datepicker_20230921');

function datepicker_shortcode_20230921() {
    <input type="text" id="datepicker">
        jQuery(document).ready(function($) {
    return ob_get_clean();

add_shortcode('datepicker', 'datepicker_shortcode_20230921');

Once you have done this Create a page and add short code [datepicker]

go to the front end and select date in the Datepicker

if you select 22nd it will show the date as 22S September 2023

rather then 22nd September 2023

it does not convert S in to nd, st, or th on the front end

Change History (4)

#1 @sabernhardt
9 months ago

  • Keywords close added; needs-patch removed

Hi and welcome to WordPress Core Trac!

The datepicker shortcode works with all four of the English preset options plus the lowercase l day of the week, but jQuery UI's datepicker does not support the S English ordinal suffix.

An old pull request was closed because it does not consider all locales. You could comment on that PR and/or open a new issue in the jQuery UI repository:

If/when they add support, WordPress could update to the latest version of the jQuery UI script.

#2 @rajeshsingh520
9 months ago


but in the older version of wordpress it used to support nd, th, rd

we had a plugin that used to work with this but suddenly it has stopped so we are raising this ticket

example: 22nd 31st do you know what letter to use to show nd, st and rd next to the date

#3 @sabernhardt
9 months ago

  • Keywords reporter-feedback added; close removed

Could you share which plugin and which WordPress version worked together?

I tried the shortcode in a custom plugin and the S character in date settings, and it did not convert to the suffix using WordPress 6.0.3, 6.2.2 or 6.3.1.

#4 @rajeshsingh520
9 months ago

That is the issue as don't remember exact version no, what I remember is it use to show date in ordinal number format but now it has stopped

am I doing it incorrect it is some other character that can show ordinal date instead of S

Note: See TracTickets for help on using tickets.