Fix wrong datetime formatting when task form shows validation errors
This commit is contained in:
@@ -292,11 +292,9 @@ class DateParser extends Base
|
||||
{
|
||||
foreach ($fields as $field) {
|
||||
if (! empty($values[$field])) {
|
||||
if (! ctype_digit($values[$field])) {
|
||||
$values[$field] = strtotime($values[$field]);
|
||||
if (ctype_digit($values[$field])) {
|
||||
$values[$field] = date($format, $values[$field]);
|
||||
}
|
||||
|
||||
$values[$field] = date($format, $values[$field]);
|
||||
} else {
|
||||
$values[$field] = '';
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ class TaskValidator extends BaseValidator
|
||||
new Validators\MaxLength('title', t('The maximum length is %d characters', 200), 200),
|
||||
new Validators\MaxLength('reference', t('The maximum length is %d characters', 50), 50),
|
||||
new Validators\Date('date_due', t('Invalid date'), $this->dateParser->getParserFormats()),
|
||||
new Validators\Date('date_started', t('Invalid date'), $this->dateParser->getParserFormats()),
|
||||
new Validators\Date('date_started', t('Invalid date'), array($this->dateParser->getUserDateTimeFormat())),
|
||||
new Validators\Numeric('time_spent', t('This value must be numeric')),
|
||||
new Validators\Numeric('time_estimated', t('This value must be numeric')),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user