Make WordPress Core

Opened 7 years ago

Last modified 6 years ago

#38106 new defect (bug)

wp_localize_jquery_ui_datepicker() bug

Reported by: jjmpsp's profile jjmpsp Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.6.1
Component: Script Loader Keywords: needs-patch reporter-feedback
Focuses: javascript Cc:

Description

jQuery UI datepicker widget plugin customisation script has bugs.

To reproduce the bug, simply add a datepicker to the page and Wordpress will format the datepicker with a US date by default, rather than using the config from core.

$(".date-input").datepicker({ 
    dateFormat: 'yy-dd-mm' 
});

I have fixed the function wp_localize_jquery_ui_datepicker(), please see the following pastebin with the corrected code:

http://pastebin.com/dkxMSNsV

A datepicker within my wordpress theme now shows UK formatted dates since implementing the fix.

Attachments (2)

38106.diff (698 bytes) - added by Presskopp 6 years ago.
38106.2.diff (539 bytes) - added by Presskopp 6 years ago.

Download all attachments as: .zip

Change History (9)

#1 follow-up: @swissspidy
7 years ago

  • Component changed from Widgets to Script Loader
  • Focuses ui accessibility removed
  • Keywords needs-patch added

Hey there,

Thanks for your report and welcome to WordPress Trac!

Would you mind uploading your changes as a proper patch file? See https://make.wordpress.org/core/handbook/tutorials/working-with-patches/ for help.

#2 in reply to: ↑ 1 @jjmpsp
7 years ago

Replying to swissspidy:

Hey there,

Thanks for your report and welcome to WordPress Trac!

Would you mind uploading your changes as a proper patch file? See https://make.wordpress.org/core/handbook/tutorials/working-with-patches/ for help.

Sure, I'll do this in a few hours (y)

@Presskopp
6 years ago

#3 @Presskopp
6 years ago

  • Keywords has-patch added; needs-patch removed

..a few hours later

Can't say if patch is appropriate, just did it.

#4 @swissspidy
6 years ago

  • Keywords needs-patch added; has-patch removed

@Presskopp When comparing with the Pastebin, the patch doesn't look correct / complete

#5 @Presskopp
6 years ago

uh, sorry, will check soon

@Presskopp
6 years ago

#6 @Presskopp
6 years ago

Hmm, all I found was a missing tab!?

#7 @swissspidy
6 years ago

  • Keywords reporter-feedback added

@jjmpsp In your Pastebin you're referencing a custom jquery-ui-datepicker-custom.js script. The rest is identical to current WordPress core code. What exactly does your script include that fixes the issue you're experiencing?

Note: See TracTickets for help on using tickets.