This commit is contained in:
Laurent Destailleur 2025-11-09 03:50:40 +01:00
parent 8d21dda08b
commit ff80a85962
3 changed files with 17 additions and 10 deletions

View file

@ -7780,15 +7780,22 @@ class Form
if ($d) {
// Show date with popup
if ($usecalendar != 'combo') {
// Set $format and $formatjs and $formatjquery
$reduceformat = (!empty($conf->dol_optimize_smallscreen) ? 1 : 0); // Test on original $format param.
if ($reduceformat) {
$format = str_replace('%Y', '%y', $langs->transnoentitiesnoconv("FormatDateShortInput")); // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
$formatjs = str_replace('yyyy', 'yy', $langs->transnoentitiesnoconv("FormatDateShortJavaInput"));
//$formatjquery = str_replace('yyyy', 'yy', $langs->trans("FormatDateShortJQueryInput"));
$formatjquery = $langs->trans("FormatDateShortJQueryInput");
} else {
$format = $langs->transnoentitiesnoconv("FormatDateShortInput"); // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
$formatjs = $langs->transnoentitiesnoconv("FormatDateShortJavaInput"); // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
$formatjquery = $langs->trans("FormatDateShortJQueryInput");
}
// Set formatted_date (for example: '%d/%m/%Y', '%m-%d-%y', ...
$formatted_date = '';
if (strval($set_time) != '' && $set_time != -1) {
$reduceformat = (!empty($conf->dol_optimize_smallscreen) ? 1 : 0); // Test on original $format param.
if ($reduceformat) {
$format = str_replace('%Y', '%y', $langs->transnoentitiesnoconv("FormatDateShortInput")); // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
} else {
$format = $langs->transnoentitiesnoconv("FormatDateShortInput"); // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
}
$formatted_date = dol_print_date($set_time, $format, $gm); // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
}
@ -7828,7 +7835,7 @@ class Form
$retstring .= '<!-- datepicker usecalendar='.$usecalendar.' --><script nonce="' . getNonce() . '" type="text/javascript">';
$retstring .= "$(function(){ $('#" . $prefix . "').datepicker({
dateFormat: '" . $langs->trans("FormatDateShortJQueryInput") . "',
dateFormat: '" . dol_escape_js($formatjquery) . "',
autoclose: true,
todayHighlight: true,
yearRange: '" . $minYear . ":" . $maxYear . "',";
@ -7860,7 +7867,7 @@ class Form
$retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="'.($usecalendar == 'html' ? "date" : "text").'" class="maxwidthdate center" maxlength="11" value="'.$formatted_date.'"';
$retstring .= ($disabled ? ' disabled' : '');
$retstring .= ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '');
$retstring .= ' onChange="dpChangeDay(\'' . dol_escape_js($prefix) . '\',\'' . dol_escape_js($langs->trans("FormatDateShortJavaInput")) . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
$retstring .= ' onChange="dpChangeDay(\'' . dol_escape_js($prefix) . '\',\'' . dol_escape_js($formatjs) . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
$retstring .= ' autocomplete="off">';
// Icon calendar

View file

@ -9150,7 +9150,7 @@ table.jPicker {
width: 220px;
}
.maxwidthdate {
max-width: 95px; /* lower than 105, text is truncated with some smartphone resolution and date on 4 digits, but we use 2 digits on smartphone */
max-width: 105px; /* lower than 105, text is truncated with some smartphone resolution and date on 4 digits, but we use 2 digits on smartphone */
}
#tooltip {

View file

@ -8902,7 +8902,7 @@ table.jPicker {
}
.maxwidthdate {
max-width: 95px; /* lower than 105, text is truncated with some smartphone resolution and date on 4 digits, but we use 2 digits on smartphone */
max-width: 105px; /* lower than 105, text is truncated with some smartphone resolution and date on 4 digits, but we use 2 digits on smartphone */
}
div.tabBar {