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.
CommentFileSizeAuthor
profile.module.diff.txt613 bytessnickl
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Steven’s picture

Status: Needs review » Fixed

Well, 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.

Anonymous’s picture

Status: Fixed » Closed (fixed)