Providing fix date and time format disregards localization
-
In the German support forums a user asked how he could localize the date and time format used for the display of comments. I looked into template
comments.php
and saw, that currently in line 30 a fixed format is hard coded into the template:<?php echo esc_html(comment_time('g:i a')); ?><?php echo " - "; echo esc_html(comment_date('M j, Y'));?>
The result is, that e.g. in German the output gets rendered in US-American date and time formats. The localization settings (Settings > General) are disregarded:
Solution would be to provide comment_time() and comment_date() without a preset format:
<?php echo esc_html(comment_time()); ?><?php echo " - "; echo esc_html(comment_date());?>
which then renders according to the localization settings, e.g.
Ver?ffentlicht am 18:39 – 26. Februar 2018
(the translation isn’t quite perfect yet and should read
Ver?ffentlicht: 18:39 – 26. Februar 2018
instead)
- The topic ‘Providing fix date and time format disregards localization’ is closed to new replies.