Add possibility to use localized date format as datepicker input placeholder

Need to be supported by skin. Elastic support is comming.
pull/6085/head
Aleksander Machniak 7 years ago
parent 8e2f6275a4
commit de544cc905

@ -65,7 +65,7 @@ class jqueryui extends rcube_plugin
}
// Date format for datepicker
$date_format = $rcmail->config->get('date_format', 'Y-m-d');
$date_format = $date_format_localized = $rcmail->config->get('date_format', 'Y-m-d');
$date_format = strtr($date_format, array(
'y' => 'y',
'Y' => 'yy',
@ -74,7 +74,19 @@ class jqueryui extends rcube_plugin
'd' => 'dd',
'j' => 'd',
));
$replaces = array('Y' => 'yyyy', 'y' => 'yy', 'm' => 'mm', 'd' => 'dd', 'j' => 'd', 'n' => 'm');
foreach (array_keys($replaces) as $key) {
if ($rcmail->text_exists("dateformat$key")) {
$replaces[$key] = $rcmail->gettext("dateformat$key");
}
}
$date_format_localized = strtr($date_format_localized, $replaces);
$rcmail->output->set_env('date_format', $date_format);
$rcmail->output->set_env('date_format_localized', $date_format_localized);
}
public static function miniColors()

@ -6341,7 +6341,6 @@ function rcube_webmail()
yearRange: '-120:+10',
showOtherMonths: true,
selectOtherMonths: true
// onSelect: function(dateText) { $(this).focus().val(dateText); }
});
$('input.datepicker').datepicker();
}
@ -6656,6 +6655,8 @@ function rcube_webmail()
if (!colprop.count) colprop.count = 0;
if (++colprop.count == colprop.limit && colprop.limit)
$(menu).children('option[value="' + col + '"]').prop('disabled', true);
this.triggerEvent('insert-edit-field', input);
}
}
}

@ -630,6 +630,13 @@ $labels['license'] = 'License';
$labels['support'] = 'Get support';
$labels['savedsearches'] = 'Saved searches';
$labels['dateformatY'] = 'YYYY';
$labels['dateformaty'] = 'YY';
$labels['dateformatm'] = 'MM';
$labels['dateformatd'] = 'DD';
$labels['dateformatj'] = 'D';
$labels['dateformatn'] = 'M';
// units
$labels['B'] = 'B';
$labels['KB'] = 'KB';

@ -302,7 +302,7 @@ function rcmail_contact_search_form($attrib)
$label = isset($colprop['label']) ? $colprop['label'] : $RCMAIL->gettext($col);
$category = $colprop['category'] ?: 'other';
// load jquery UI datepicker for date fields
// load jquery UI datepicker for date fields
if ($colprop['type'] == 'date') {
$colprop['class'] .= ($colprop['class'] ? ' ' : '') . 'datepicker';
}

Loading…
Cancel
Save