Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Current code uses ' - ' as a split marker for the format string, as only the date portion is needed.
However, in the "Y-m-d H:i" format there is no dash, so we end up with "H:i" tailing the output!
My solution here isn't exactly elegant, but the only simple property that all formats have in common is that the date portion is always first, and always five chars long (format for year, month, day plus two separators).
--- profile.module 2006-03-31 22:15:39.000000000 +0200
+++ profile.module.new 2006-03-31 22:15:18.000000000 +0200
@@ -191,7 +191,7 @@
case 'url':
return '<a href="'. check_url($value) .'">'. check_plain($value) .'</a>';
case 'date':
- list($format) = explode(' - ', variable_get('date_format_short', 'm/d/Y - H:i'), 2);
+ $format = substr(variable_get('date_format_short', 'm/d/Y - H:i'), 0, 5);
// Note: we avoid PHP's date() because it does not handle dates before
// 1970 on Windows. This would make the date field useless for e.g.
// birthdays.
Comment | File | Size | Author |
---|---|---|---|
profile.module.diff.txt | 613 bytes | snickl |
Comments
Comment #1
Steven CreditAttribution: Steven commentedWell, it fixes the bug at least... needs to be solved properly by splitting up our formats into date and time I imagine. But the substr() matches all formats we have now.
Committed to HEAD.
Comment #2
(not verified) CreditAttribution: commented