You are here

function date_popup_timepicker_format_replacements in Date 7.2

Same name and namespace in other branches
  1. 7.3 date_popup/date_popup.module \date_popup_timepicker_format_replacements()

Return a map of format replacements required for a given timepicker.

Client-side time entry plugins don't support all possible date formats. This function returns a map of format replacements required to change any input format into one that the given timepicker can support.

Parameters

string $timepicker: The time entry plugin being used: 'wvega', 'timepicker' or 'default'.

Return value

array A map of replacements.

1 call to date_popup_timepicker_format_replacements()
date_popup_format_to_popup_time in date_popup/date_popup.module
Recreate a time format string so it has the values popup expects.

File

date_popup/date_popup.module, line 789
A module to enable jQuery calendar and time entry popups.

Code

function date_popup_timepicker_format_replacements($timepicker = 'default') {
  switch ($timepicker) {
    case 'wvega':

      // The wvega timepicker only supports uppercase AM/PM.
      return array(
        'a' => 'A',
      );
    case 'timepicker':

      // The jquery_ui timepicker supports all possible date formats.
      return array();
    default:

      // The default timeEntry plugin requires leading zeros.
      return array(
        'G' => 'H',
        'g' => 'h',
      );
  }
}