Re-ordering the elements of a Drupal Webform Datepicker

The Date Picker widget, when using webforms, defaultly appears in American form (Month, Day, Year). For UK sites this isn't often desirable. Doing a quick google and I stumbled upon 's blog post on how to re-theme the element from earlier this year. I thought it was certainly one approach, but felt there must have been a neater alternative. So here is my approach:


/**
 * Implements hook_webform_component_render_alter().
 */
function THEMENAME_webform_component_render_alter(&$element, &$component) {
  if ($element['#type'] == 'date') {
    $element['#process'][] = 'THEMENAME_webform_expand_date';
  }
}

/**
 * Process function to re-order the elements in the date widget.
 */
function THEMENAME_webform_expand_date($element) {
  $element['day']['#weight'] = 0;
  $element['month']['#weight'] = 1;
  $element['year']['#weight'] = 2;
  return $element;
}

Obviously you can replace THEMENAME with what ever theme or module name you like; in my case I put this in the template.php file.