date_t function don't work with abbr translations. For example, when calling date_t('Apr', 'month_abbr', 'en'), the returned string is ''.

This is because array $untranslated don't have the right keys.
A possible fix for month_abbr could be :

  case 'month_abbr':
    $untranslated = array_flip(array_map('_date_substr_3', date_month_names_untranslated()));
    break;
  case 'month_name':
    $untranslated = array_flip(date_month_names_untranslated());
    break;

This code need to add a new function :

function _date_substr_3($string) {
  return substr($string, 0, 3);
}
CommentFileSizeAuthor
#1 date_api.module.patch962 bytesanon

Comments

anon’s picture

Version: 6.x-2.1 » 6.x-2.3
StatusFileSize
new962 bytes

I created a patch for this based on B-Prod's solution.

anon’s picture

Title: date_t and month_abbr » date_t and month_abbr (patch included)
Status: Patch (to be ported) » Active

This error still occur in 6.x-2.4

anon’s picture

Version: 6.x-2.3 » 6.x-2.4

forgott to change version. Sorry

damienmckenna’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

Unfortunately the Drupal 6 version of the Date module is no longer supported. That said, we appreciate that you took time to work on this issue. Should this request still be relevant for Drupal 7 please feel free to reopen it. Thank you.