BUG 11928 " Ultimo digito de una fecha se muestra incompleto" SOLVED
- Ultimo digito de una fecha se muestra incompleto. - Problema resuelto, se ha aumentado el tamaño del campo
This commit is contained in:
@@ -4464,6 +4464,8 @@ class XmlForm_Field_Date extends XmlForm_Field_SimpleText
|
|||||||
$mask = '%Y-%m-%d'; //set default
|
$mask = '%Y-%m-%d'; //set default
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$valueDemo = masktophp($mask, "today");
|
||||||
|
|
||||||
if ($this->defaultValue != "") {
|
if ($this->defaultValue != "") {
|
||||||
$defaultValue = masktophp( $mask, $defaultValue);
|
$defaultValue = masktophp( $mask, $defaultValue);
|
||||||
}
|
}
|
||||||
@@ -4528,11 +4530,11 @@ class XmlForm_Field_Date extends XmlForm_Field_SimpleText
|
|||||||
$Time = 'false';
|
$Time = 'false';
|
||||||
|
|
||||||
if (($sizehour !== false) && ($sizemin !== false) && ($sizesec !== false)) {
|
if (($sizehour !== false) && ($sizemin !== false) && ($sizesec !== false)) {
|
||||||
$sizeend = $maskleng + 2;
|
$Time = "true";
|
||||||
$Time = 'true';
|
|
||||||
} else {
|
|
||||||
$sizeend = $maskleng + 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$sizeend = strlen($valueDemo) + 3;
|
||||||
|
|
||||||
if ($this->required) {
|
if ($this->required) {
|
||||||
$isRequired = '1';
|
$isRequired = '1';
|
||||||
} else {
|
} else {
|
||||||
@@ -4567,7 +4569,7 @@ class XmlForm_Field_Date extends XmlForm_Field_SimpleText
|
|||||||
}
|
}
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function maskDateValue ($value, $field)
|
public function maskDateValue ($value, $field)
|
||||||
{
|
{
|
||||||
$value = trim($value);
|
$value = trim($value);
|
||||||
@@ -4607,13 +4609,13 @@ class XmlForm_Field_Date extends XmlForm_Field_SimpleText
|
|||||||
$mask .= '%' . $part;
|
$mask .= '%' . $part;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$withHours = (strpos($mask, '%H') !== false || strpos($mask, '%M') !== false || strpos($mask, '%S') !== false);
|
$withHours = (strpos($mask, '%H') !== false || strpos($mask, '%M') !== false || strpos($mask, '%S') !== false);
|
||||||
|
|
||||||
$tmp = str_replace( "%", "", $mask );
|
$tmp = str_replace( "%", "", $mask );
|
||||||
return $this->date_create_from_format($tmp, $value, $withHours);
|
return $this->date_create_from_format($tmp, $value, $withHours);
|
||||||
}
|
}
|
||||||
|
|
||||||
function date_create_from_format( $dformat, $dvalue, $withHours = false )
|
function date_create_from_format( $dformat, $dvalue, $withHours = false )
|
||||||
{
|
{
|
||||||
$schedule = $dvalue;
|
$schedule = $dvalue;
|
||||||
@@ -4623,9 +4625,9 @@ class XmlForm_Field_Date extends XmlForm_Field_SimpleText
|
|||||||
'%04d-%02d-%02d %02d:%02d:%02d',
|
'%04d-%02d-%02d %02d:%02d:%02d',
|
||||||
$ugly['tm_year'] + 1900,
|
$ugly['tm_year'] + 1900,
|
||||||
$ugly['tm_mon'] + 1,
|
$ugly['tm_mon'] + 1,
|
||||||
$ugly['tm_mday'],
|
$ugly['tm_mday'],
|
||||||
$ugly['tm_hour'],
|
$ugly['tm_hour'],
|
||||||
$ugly['tm_min'],
|
$ugly['tm_min'],
|
||||||
$ugly['tm_sec']
|
$ugly['tm_sec']
|
||||||
);
|
);
|
||||||
$new_schedule = new DateTime($ymd);
|
$new_schedule = new DateTime($ymd);
|
||||||
@@ -5935,29 +5937,29 @@ function masktophp ($mask, $value)
|
|||||||
|
|
||||||
if (!function_exists('strptime')) {
|
if (!function_exists('strptime')) {
|
||||||
function strptime($date, $format) {
|
function strptime($date, $format) {
|
||||||
$masks = array(
|
$masks = array(
|
||||||
'%d' => '(?P<d>[0-9]{2})',
|
'%d' => '(?P<d>[0-9]{2})',
|
||||||
'%m' => '(?P<m>[0-9]{2})',
|
'%m' => '(?P<m>[0-9]{2})',
|
||||||
'%Y' => '(?P<Y>[0-9]{4})',
|
'%Y' => '(?P<Y>[0-9]{4})',
|
||||||
'%H' => '(?P<H>[0-9]{2})',
|
'%H' => '(?P<H>[0-9]{2})',
|
||||||
'%M' => '(?P<M>[0-9]{2})',
|
'%M' => '(?P<M>[0-9]{2})',
|
||||||
'%S' => '(?P<S>[0-9]{2})',
|
'%S' => '(?P<S>[0-9]{2})',
|
||||||
// usw..
|
// usw..
|
||||||
);
|
);
|
||||||
|
|
||||||
$rexep = "#".strtr(preg_quote($format), $masks)."#";
|
$rexep = "#".strtr(preg_quote($format), $masks)."#";
|
||||||
if(!preg_match($rexep, $date, $out)) {
|
if(!preg_match($rexep, $date, $out)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$ret = array(
|
$ret = array(
|
||||||
"tm_sec" => (int) isset($out['S']) ? $out['S'] : 0,
|
"tm_sec" => (int) isset($out['S']) ? $out['S'] : 0,
|
||||||
"tm_min" => (int) isset($out['M']) ? $out['M'] : 0,
|
"tm_min" => (int) isset($out['M']) ? $out['M'] : 0,
|
||||||
"tm_hour" => (int) isset($out['H']) ? $out['H'] : 0,
|
"tm_hour" => (int) isset($out['H']) ? $out['H'] : 0,
|
||||||
"tm_mday" => (int) $out['d'],
|
"tm_mday" => (int) $out['d'],
|
||||||
"tm_mon" => $out['m'] ? $out['m'] - 1 : 0,
|
"tm_mon" => $out['m'] ? $out['m'] - 1 : 0,
|
||||||
"tm_year" => $out['Y'] > 1900 ? $out['Y'] - 1900 : 0,
|
"tm_year" => $out['Y'] > 1900 ? $out['Y'] - 1900 : 0,
|
||||||
);
|
);
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user