From: anuko Date: Sun, 5 Nov 2017 14:07:03 +0000 (+0000) Subject: Some cleanup and commenting. X-Git-Tag: timetracker_1.19-1~1459 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=cafeaa310010bf6d4a91f592e98227b89892a3c8;p=timetracker.git Some cleanup and commenting. --- diff --git a/WEB-INF/lib/DateAndTime.class.php b/WEB-INF/lib/DateAndTime.class.php index d960f008..4752e99f 100644 --- a/WEB-INF/lib/DateAndTime.class.php +++ b/WEB-INF/lib/DateAndTime.class.php @@ -287,27 +287,17 @@ class DateAndTime { } function isError() { - if ($this->mParseResult!=0) return true; + if ($this->mParseResult != 0) return true; return false; } - function getClone() { - if (version_compare(phpversion(), '5.0') < 0) { - $d = new DateAndTime($this->getFormat()); - $d->setTimestamp($this->getTimestamp()); - return $d; - } else { - return clone($this); - } - } - function before(/*DateAndTime*/ $obj) { - if ($this->getTimestamp()<$obj->getTimestamp()) return true; + if ($this->getTimestamp() < $obj->getTimestamp()) return true; return false; } function after(/*DateAndTime*/ $obj) { - if ($this->getTimestamp()>$obj->getTimestamp()) return true; + if ($this->getTimestamp() > $obj->getTimestamp()) return true; return false; } @@ -316,12 +306,6 @@ class DateAndTime { return false; } - function nextDate() { - $d = $this->getClone(); - $d->incDay(); - return $d; - } - function decDay(/*int*/$days=1) { $this->setTimestamp(@mktime($this->mHour, $this->mMinute, $this->mSecond, $this->mMonth, $this->mDate - $days, $this->mYear)); } diff --git a/WEB-INF/lib/Period.class.php b/WEB-INF/lib/Period.class.php index 5730a75d..0e901a8d 100644 --- a/WEB-INF/lib/Period.class.php +++ b/WEB-INF/lib/Period.class.php @@ -52,9 +52,14 @@ define('INTERVAL_PREVIOUS_DAY', 44); define('INTERVAL_SELECTED_DAY', 48); */ +// TODO: Refactoring is needed for this class. Probably by refactoring DateAndTime first, as Period is +// basically a collection of 2 DateAndTime instances. +// +// Second problem is that "today" is (most likely?) server today, so reports may give incorrect dates +// for browser users in different time zones. Verify and fix this. class Period { - var $startDate; - var $endDate; + var $startDate; // DateAndTime object. + var $endDate; // DateAndTime object. function __construct($period_type = 0, $date_point = null) {