summaryrefslogtreecommitdiff
path: root/app/Model
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-01-25 18:55:11 -0500
committerFrederic Guillot <fred@kanboard.net>2015-01-25 18:55:11 -0500
commit28a7f57d86c2c2fbef92da37eacb19980a133ed2 (patch)
treefd9c19da9d81535b35d4118e741acc931d82f40f /app/Model
parent1fc6d69e2e25d6e4feaa38fe03dab98c75cfb36c (diff)
Store due date without the time
Diffstat (limited to 'app/Model')
-rw-r--r--app/Model/DateParser.php8
-rw-r--r--app/Model/SubtaskExport.php4
-rw-r--r--app/Model/TaskExport.php4
3 files changed, 8 insertions, 8 deletions
diff --git a/app/Model/DateParser.php b/app/Model/DateParser.php
index 53fc9b76..8a4d3edd 100644
--- a/app/Model/DateParser.php
+++ b/app/Model/DateParser.php
@@ -87,13 +87,13 @@ class DateParser extends Base
}
/**
- * For a given timestamp, reset the date to midnight
+ * Remove the time from a timestamp
*
* @access public
* @param integer $timestamp Timestamp
* @return integer
*/
- public function resetDateToMidnight($timestamp)
+ public function removeTimeFromTimestamp($timestamp)
{
return mktime(0, 0, 0, date('m', $timestamp), date('d', $timestamp), date('Y', $timestamp));
}
@@ -107,7 +107,7 @@ class DateParser extends Base
*/
public function getTimestampFromIsoFormat($date)
{
- return $this->resetDateToMidnight(strtotime($date));
+ return $this->removeTimeFromTimestamp(strtotime($date));
}
/**
@@ -147,7 +147,7 @@ class DateParser extends Base
foreach ($fields as $field) {
if (! empty($values[$field]) && ! is_numeric($values[$field])) {
- $values[$field] = $this->getTimestamp($values[$field]);
+ $values[$field] = $this->removeTimeFromTimestamp($this->getTimestamp($values[$field]));
}
}
}
diff --git a/app/Model/SubtaskExport.php b/app/Model/SubtaskExport.php
index 672c50c6..1e728c05 100644
--- a/app/Model/SubtaskExport.php
+++ b/app/Model/SubtaskExport.php
@@ -94,11 +94,11 @@ class SubtaskExport extends Base
public function getSubtasks($project_id, $from, $to)
{
if (! is_numeric($from)) {
- $from = $this->dateParser->resetDateToMidnight($this->dateParser->getTimestamp($from));
+ $from = $this->dateParser->removeTimeFromTimestamp($this->dateParser->getTimestamp($from));
}
if (! is_numeric($to)) {
- $to = $this->dateParser->resetDateToMidnight(strtotime('+1 day', $this->dateParser->getTimestamp($to)));
+ $to = $this->dateParser->removeTimeFromTimestamp(strtotime('+1 day', $this->dateParser->getTimestamp($to)));
}
return $this->db->table(SubTask::TABLE)
diff --git a/app/Model/TaskExport.php b/app/Model/TaskExport.php
index 9545d062..90aa1964 100644
--- a/app/Model/TaskExport.php
+++ b/app/Model/TaskExport.php
@@ -77,11 +77,11 @@ class TaskExport extends Base
';
if (! is_numeric($from)) {
- $from = $this->dateParser->resetDateToMidnight($this->dateParser->getTimestamp($from));
+ $from = $this->dateParser->removeTimeFromTimestamp($this->dateParser->getTimestamp($from));
}
if (! is_numeric($to)) {
- $to = $this->dateParser->resetDateToMidnight(strtotime('+1 day', $this->dateParser->getTimestamp($to)));
+ $to = $this->dateParser->removeTimeFromTimestamp(strtotime('+1 day', $this->dateParser->getTimestamp($to)));
}
$rq = $this->db->execute($sql, array($from, $to, $project_id));