Wrong output timestamp order updates
-
Hello,
Wordpress: 5.4
Woocommerce: 4.0.1
PHP: 7.0
Site Health: no issuesI am at a stage where I test orders and found that when a customer goes to his/her account and views their order, they are facing a bizar string that normally should be a date and/or timestamp for their order updates (which is added to the customers order via the backend by the admin as a note).
760+03:004, b+03:004, 47+03:004, 47pm4pm:
I checked the codes in both the Woocommerce template and the active theme files which are:
view-order.php
These are the lines causing the output in both files:
<p class="woocommerce-OrderUpdate-meta meta"><?php echo date_i18n( esc_html__( 'l jS \o\f F Y, h:ia', 'woocommerce' ), strtotime( $note->comment_date ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></p><p class="woocommerce-OrderUpdate-meta meta"><?php echo date_i18n( esc_html__( 'l jS \o\f F Y, h:ia', 'porto' ), strtotime( $note->comment_date ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></p>I tried googling but I did not understand, which is why I am asking here:
What is the problem?
-
I managed to find the used function on the wordpress site and found out that the
h in h:ia part is not correct! It should be g
But not I am stuck with date and time output that does not follow the correct format as setup in the backend:
Pazar 5th of Nisan 2020, 8:14pm
I have found the actual error.
I run Loco translate as my translation plugin. I digged in and it showed me that the original default language file is messed up for this specific date and time stamp. Output can be found under “orders” “order updates”.
Wrongfully, it was translated by default to some random words. In combination with the date_i18n function, those words output to “random” numbers etc and do not give the proper date and time. Just to be clear, Loco translate was not the guilty plugin. The translation file is incorrect.
I override the format by delivering a replacing string of correctly formatted date and time. Now it works.
Maybe I should report the error that exists in the Turkish language pack.
-
This reply was modified 6 years, 2 months ago by
mzitnamor.
-
This reply was modified 6 years, 2 months ago by
The topic ‘Wrong output timestamp order updates’ is closed to new replies.