• Resolved Stonehenge Creations

    (@duisterdenhaag)


    Hi,
    Currently all dates within EDD are being formatted as m/d/Y (USA-only date format), due to hard coding the formatting:

    For example: “view-order-details.php”, line 108:
    <input type="text" name="edd-payment-date" value="<?php echo esc_attr( date( 'm/d/Y', $payment_date ) ); ?>" class="medium-text edd_datepicker"/>

    This is really confusing for non-Americans, because “day” and “month” are in reversed order for us. “01/05/2020” means “1st of May” to me. As you can see here, m/d/Y is world-wide uncommon.

    Could please update your code so that date outputs and datepickers use the WordPress get_option('date_format');?
    Else please change it to the international formatting “Y-m-d”.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi @duisterdenhaag

    Thanks for providing detailed response.

    @cklosows will take a look into this with future development.

    I will raise a ticket to EDD git also. Thanks for your feedback.

    Plugin Author Chris Klosowski

    (@cklosows)

    Thanks @pratik-jain

    I’m actually no longer the lead dev of EDD, that’s been transitioned to @nosegraze (Ashley Gibson).

    We’ve done a lot of updates to EDD 3.0 related to dates so it’d be best to check against that before logging any issues. If it’s fixed in 3.0 then we likely won’t need any issues opened.

    I can confirm that EDD 3.0 has this in YYYY-MM-DD.

    Using date format settings is tricky with datepickers, because the format has to sync up with what the JavaScript picker supports.

    Thread Starter Stonehenge Creations

    (@duisterdenhaag)

    Hi @nosegraze,
    As a WordPress plugin developer myself I know exactly what you mean. And I struggled with the very same issue… There are a lot of different date formats world-wide and PHP has a different notation than jQuery.

    All date formats are available through the PHP Intl module. But relying on that for plugins can be tricky, because users might not have it installed and then the code can lead to fatal errors…

    I have created a resource (JSON file) that retrieves the short and full date formatting by WordPress locale, based on the official ICU formatting – converted to PHP and jQuery notations. It even includes rtl indication and words like ‘den’ (Danish) and ‘de’ (All Spanish locales).

    This makes it extremely easy to align echo PHP dates with jQuery date picker results in the blog’s locale, bypassing the need of the INTL module.

    The JSON file can be found here: https://pastebin.com/eT3ku5fR
    And some examples of how you can use them are available here: https://pastebin.com/jmctaqaM

    Saving entries to the database could be as simple as this:
    date( 'Y-m-d', strtotime( sanitize_text_field( $_POST['date_input'] ) );

    Perhaps your team could look into that?

    Plugin Support Mihai Joldis

    (@misulicus)

    Hey @duisterdenhaag

    Thanks for the info. Will mark this topic as resolved for now as it is something our team will tackle in future releases.

    Regards

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Please localize dates, datepickers & time.’ is closed to new replies.