when exporting to csv and when displaying results as a table the dates are displayed in the format mm/dd/yy, this is not the correct notation for dates in the Netherlands (where i happen to live). We use the notation dd-mm-yy(yy).

When looking at the code of the date.inc file i noticed that the dates are output in a non-configurable form. Maybe it would be a good thing to use the user/site locale settings for displaying dates. I'm not sure when exactly the theme_webform_date is called, but can't we split out the code in there in a separate function that returns a formatted date and use that to ouput the correctly formatted date to csv/table view? This would make i18n trouble almost history, correct me if i'm wrong though...

Comments

quicksketch’s picture

Status: Postponed (maintainer needs more info) » Active

I'm working on the date.inc right now actually. I've got a little chunk of code that does just what you suggest. Though I hadn't planned on updating the CSV format, thanks for pointing that one out also. Here's what I'll be using to generate a correct format according to the site settings. This was used for e-mails, I'll need to abstract it out so we can use the site's "short" format for the CSV.

    $timestamp = strtotime($data['month'] ."/". $data['day'] ."/". $data['year']);

    // Format date according to site's medium format.
    $format = variable_get('date_format_medium', 'D, m/d/Y - H:i');
    $time = 'aABgGhHisueIOPTZ';
    $day_of_week = 'Dlw';
    $special = ',-: ';
    $format = trim($format, $time . $day_of_week . $special);

    $output .= " ". date($format, $timestamp);
quicksketch’s picture

Status: Active » Fixed

The new version of the date component (just added) now takes into account site settings when displaying a form element, sending e-mails, and in the CSV download. Thanks for reporting this, I would have missed the CSV one for sure.

The date.inc basically got an overhaul. Please try out the latest dev or CVS version and open a new issue for any new problems. Thanks!

Drupal 5: http://cvs.drupal.org/viewcvs/drupal/contributions/modules/webform/compo...
Drupal 6: http://cvs.drupal.org/viewcvs/drupal/contributions/modules/webform/compo...

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.