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:
Luis Fernando Saisa Lopez
2013-05-23 14:22:29 +00:00
parent 7f18a11358
commit 715e2060a2

View File

@@ -4464,6 +4464,8 @@ class XmlForm_Field_Date extends XmlForm_Field_SimpleText
$mask = '%Y-%m-%d'; //set default
}
$valueDemo = masktophp($mask, "today");
if ($this->defaultValue != "") {
$defaultValue = masktophp( $mask, $defaultValue);
}
@@ -4528,11 +4530,11 @@ class XmlForm_Field_Date extends XmlForm_Field_SimpleText
$Time = 'false';
if (($sizehour !== false) && ($sizemin !== false) && ($sizesec !== false)) {
$sizeend = $maskleng + 2;
$Time = 'true';
} else {
$sizeend = $maskleng + 2;
$Time = "true";
}
$sizeend = strlen($valueDemo) + 3;
if ($this->required) {
$isRequired = '1';
} else {
@@ -4567,7 +4569,7 @@ class XmlForm_Field_Date extends XmlForm_Field_SimpleText
}
return $html;
}
public function maskDateValue ($value, $field)
{
$value = trim($value);
@@ -4607,13 +4609,13 @@ class XmlForm_Field_Date extends XmlForm_Field_SimpleText
$mask .= '%' . $part;
}
}
$withHours = (strpos($mask, '%H') !== false || strpos($mask, '%M') !== false || strpos($mask, '%S') !== false);
$tmp = str_replace( "%", "", $mask );
return $this->date_create_from_format($tmp, $value, $withHours);
}
function date_create_from_format( $dformat, $dvalue, $withHours = false )
{
$schedule = $dvalue;
@@ -4623,9 +4625,9 @@ class XmlForm_Field_Date extends XmlForm_Field_SimpleText
'%04d-%02d-%02d %02d:%02d:%02d',
$ugly['tm_year'] + 1900,
$ugly['tm_mon'] + 1,
$ugly['tm_mday'],
$ugly['tm_hour'],
$ugly['tm_min'],
$ugly['tm_mday'],
$ugly['tm_hour'],
$ugly['tm_min'],
$ugly['tm_sec']
);
$new_schedule = new DateTime($ymd);
@@ -5935,29 +5937,29 @@ function masktophp ($mask, $value)
if (!function_exists('strptime')) {
function strptime($date, $format) {
$masks = array(
'%d' => '(?P<d>[0-9]{2})',
'%m' => '(?P<m>[0-9]{2})',
'%Y' => '(?P<Y>[0-9]{4})',
'%H' => '(?P<H>[0-9]{2})',
'%M' => '(?P<M>[0-9]{2})',
'%S' => '(?P<S>[0-9]{2})',
// usw..
);
$masks = array(
'%d' => '(?P<d>[0-9]{2})',
'%m' => '(?P<m>[0-9]{2})',
'%Y' => '(?P<Y>[0-9]{4})',
'%H' => '(?P<H>[0-9]{2})',
'%M' => '(?P<M>[0-9]{2})',
'%S' => '(?P<S>[0-9]{2})',
// usw..
);
$rexep = "#".strtr(preg_quote($format), $masks)."#";
if(!preg_match($rexep, $date, $out)) {
return false;
return false;
}
$ret = array(
$ret = array(
"tm_sec" => (int) isset($out['S']) ? $out['S'] : 0,
"tm_min" => (int) isset($out['M']) ? $out['M'] : 0,
"tm_hour" => (int) isset($out['H']) ? $out['H'] : 0,
"tm_mday" => (int) $out['d'],
"tm_mon" => $out['m'] ? $out['m'] - 1 : 0,
"tm_min" => (int) isset($out['M']) ? $out['M'] : 0,
"tm_hour" => (int) isset($out['H']) ? $out['H'] : 0,
"tm_mday" => (int) $out['d'],
"tm_mon" => $out['m'] ? $out['m'] - 1 : 0,
"tm_year" => $out['Y'] > 1900 ? $out['Y'] - 1900 : 0,
);
return $ret;
);
return $ret;
}
}