Hi there, quick question. I've searched the issues and all of drupal relentlessly and haven't gotten anything.

I have a date field and the input is rendering as YYYY/DD/MM

I want to change it to MM/DD/YYYY, I've tried to hack the code and have also messed with my date formatting, and they're all in mm/dd/yyyy in one way or another. How can I change the format in which the order in which the select fields are rendered?

any help is much, much appreciated.
A

Comments

quicksketch’s picture

Webform expands the date using the Drupal core function expand_date (http://api.lullabot.com/expand_date) which determines the display order based on the "short" date format. If you adjust your short date format, Webform's form elements should render the date field to match it (assuming that the "short" date has all the necessary parts of month, day, and year).

quicksketch’s picture

Status: Active » Fixed

I've double-checked that this and it still works as expected. Just update your site's "Short" format at admin/settings/date-time and Webform should match that format when displaying date fields.

gamelodge’s picture

I would like to remove Day from my form so all I have is month/year, I have tried changing the short format to suit this but it still shows day... how should i go about removing 'day'

quicksketch’s picture

Status: Fixed » Closed (fixed)

I would like to remove Day from my form so all I have is month/year

This is not possible with Webform and is not related to this request. If you're doing credit cards (sounds like a likely guess), try http://drupal.org/project/webform_pay.

gamelodge’s picture

Thanks quicksketch

I might give that a try next time.

For those interested here is what I did to get it working.

  • I simply hid the day field with css
  • Change the date element validator to a custom validator had to apply patch: http://drupal.org/node/722298 to get this to work
  • I forced day validation in my custom validator
  • I created a custom theme_webform_mail_date to display the date in emails as month/year