summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/Core/DateParser.php4
-rw-r--r--app/Model/ProjectModel.php8
-rw-r--r--app/Template/project_edit/dates.php8
3 files changed, 14 insertions, 6 deletions
diff --git a/app/Core/DateParser.php b/app/Core/DateParser.php
index a7b10a7a..5d770241 100644
--- a/app/Core/DateParser.php
+++ b/app/Core/DateParser.php
@@ -304,6 +304,10 @@ class DateParser extends Base
{
foreach ($fields as $field) {
if (! empty($values[$field])) {
+ if (! ctype_digit($values[$field])) {
+ $values[$field] = strtotime($values[$field]);
+ }
+
$values[$field] = date($format, $values[$field]);
} else {
$values[$field] = '';
diff --git a/app/Model/ProjectModel.php b/app/Model/ProjectModel.php
index d2019b72..aba5eee2 100644
--- a/app/Model/ProjectModel.php
+++ b/app/Model/ProjectModel.php
@@ -419,6 +419,14 @@ class ProjectModel extends Base
$values['identifier'] = strtoupper($values['identifier']);
}
+ if (! empty($values['start_date'])) {
+ $values['start_date'] = $this->dateParser->getIsoDate($values['start_date']);
+ }
+
+ if (! empty($values['end_date'])) {
+ $values['end_date'] = $this->dateParser->getIsoDate($values['end_date']);
+ }
+
$this->helper->model->convertIntegerFields($values, array('priority_default', 'priority_start', 'priority_end'));
return $this->exists($values['id']) &&
diff --git a/app/Template/project_edit/dates.php b/app/Template/project_edit/dates.php
index 48135ddc..1c2c3dd4 100644
--- a/app/Template/project_edit/dates.php
+++ b/app/Template/project_edit/dates.php
@@ -11,12 +11,8 @@
<?= $this->form->csrf() ?>
<?= $this->form->hidden('id', $values) ?>
<?= $this->form->hidden('name', $values) ?>
-
- <?= $this->form->label(t('Start date'), 'start_date') ?>
- <?= $this->form->text('start_date', $values, $errors, array('maxlength="10"'), 'form-date') ?>
-
- <?= $this->form->label(t('End date'), 'end_date') ?>
- <?= $this->form->text('end_date', $values, $errors, array('maxlength="10"'), 'form-date') ?>
+ <?= $this->form->date(t('Start date'), 'start_date', $values, $errors) ?>
+ <?= $this->form->date(t('End date'), 'end_date', $values, $errors) ?>
<div class="form-actions">
<button type="submit" class="btn btn-blue"><?= t('Save') ?></button>