woocommerce / woocommerce

A customizable, open-source ecommerce platform built on WordPress. Build any commerce solution you can imagine.
https://woocommerce.com
9.2k stars 10.74k forks source link

[Enhancement]: Localize the date picker #46504

Open JacklynBiggin opened 2 months ago

JacklynBiggin commented 2 months ago

Describe the solution you'd like

Based on feedback from this tweet: https://twitter.com/Wonderm00n/status/1778393193316487589

The current date picker is very US-centric - MM/DD/YYYY isn't a universally used format. Other formats include DD/MM/YYYY and YYYY-MM-DD.

The tweet suggested using the ISO format (YYYY-MM-DD), but a followup comment suggested localizing this, potentially by the store's location or language.

image

Describe alternatives you've considered

An alternative to automatic localization would be to allowing the user to manually set the format in WooCommerce's settings.

Additional context

No response

beaulebens commented 2 months ago

Definitely looks like a case where we just need to use the same date format setting as the WP install (Settings > General > Date Format)

webdados commented 2 months ago

Disclaimer: I'm the author of the tweet mentioned by @JacklynBiggin

While I agree with @beaulebens, maybe the date format setting in WordPress is way too flexible and people may choose formats not compatible with a date picker.

In short, my opinion on this is:

In the spirit of the "decisions not options" WordPress moto, my opinion is that (in the impossibility of using the format set in WordPress by the website admin himself) we should lock it ISO 8601. Locking to the format it is set today is a decision, but not the best for a piece of software used globally.

beaulebens commented 2 months ago

Hrm, good points @webdados.

I wonder just how complex people get with that formatting, and if that would really be a problem -- I know it's typically for front-end display in the context of posts/pages, so I assume a lot of people use longer formats (April 12, 2024) which is probably not the most ergonomic for something like this.

The other thing is that we're talking about a field with a date-picker, so probably a lot of people point-click to get the date they want, although I'm sure plenty of folks want to be able to manually enter something, or at least tweak an existing date by a day in either direction or whatever.

Considering all of the above, and the pretty universally-understandable form of ISO8601 (Standards exist for a reason, indeed -- and looking at IBM's list, a surprising (to me!) number of countries actually use it for their national standard), I'd think that's actually probably the best approach here.

Maybe at some point we could offer a filter allowing people with extremely strong opinions to change the format, but I suspect that's going to add a fair amount of complexity between JS and PHP support, so probably not worth it unless we get really strong feedback.

webdados commented 2 months ago

I've changed the link, on my previous comment, for the international formats from the IBM list to Wikipedia, as I found some errors on the first one.

webdados commented 2 months ago

WooCommerce team: any comments/decisions/updates on this?