WordPress.org

Make WordPress Core

Opened 6 months ago

Last modified 4 months ago

#43028 new defect (bug)

Remove numbers before month in dropdown, it makes user confused when drowdown is not opened

Reported by: nilamacharya Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 3.3
Component: Date/Time Keywords: has-screenshots has-patch
Focuses: ui, administration Cc:

Description

Bug: Remove numbers before month in dropdown, it makes user confused when drowdown is not opened

  1. Navigate to Header from left Rail
  2. Select "Header Media"
  3. Make anu changes
  4. Select "setting" icon near "publish" button from top
  5. Select "Schedule" radio button
  6. Check Date Field

Attachments (2)

wp dropdown.png (211.3 KB) - added by nilamacharya 6 months ago.
43028.patch (669 bytes) - added by zalu1512 5 months ago.
resolved dropdown issue

Download all attachments as: .zip

Change History (6)

#1 @birgire
6 months ago

  • Focuses ui added
  • Keywords has-screenshots added
  • Version changed from 4.9.1 to 3.3

@nilamacharya Welcome to WordPress trac

I must admit that this has confused me too, as e.g. 01-jan looks like "1st of January" to me.

It seems to be generated within get_month_choices(), introduced in version 4.9:

$months[ $i ]['text']  = sprintf( __( '%1$s-%2$s' ), $i, $month_text );

https://core.trac.wordpress.org/browser/tags/4.9/src/wp-includes/customize/class-wp-customize-date-time-control.php#L194

On my test install it shows as a 1-jan format, compared to the 01-jan format when editing post dates. That's because only the latter is zeroised with: $monthnum = zeroise($i, 2);. At least these two should be using the same format (like jan, 1-jan or 01-jan) for the sake of constistency.

I checked the post date editing, and it's generated within the touch_time() function:

$month .= sprintf( __( '%1$s-%2$s' ), $monthnum, $monthtext ) . "</option>\n";

https://core.trac.wordpress.org/browser/tags/4.9/src/wp-admin/includes/template.php#L726

This 01-jan format was introduced in version 3.3, where @jane writes:

For those people who have trouble converting numerical dates to text month names, let's amend the date picker month dropdown to include the month number as well, credit card form style.

See ticket #18838 and changeset [18860].

Last edited 6 months ago by birgire (previous) (diff)

#2 @zalak151291
5 months ago

$month_text = $wp_locale->get_month_abbrev( $wp_locale->get_month( $i ) );
$months[ $i ]['text']  = sprintf($month_text);
$months[ $i ]['value'] = $i;

#3 @zalu1512
5 months ago

Hi,

I have resoled month dropdown problem and please let me know if any other changes.

Thanks.

@zalu1512
5 months ago

resolved dropdown issue

#4 @nilamacharya
4 months ago

  • Keywords has-patch added
Note: See TracTickets for help on using tickets.