diff options
author | Benaka <diosmosis@users.noreply.github.com> | 2017-09-11 16:08:42 +0300 |
---|---|---|
committer | Matthieu Aubry <mattab@users.noreply.github.com> | 2017-09-11 16:08:42 +0300 |
commit | f0ddb70c85a6211540797665f17d36b6d79128a4 (patch) | |
tree | 605ef83a15a39b1d30d6641234b83aee58ec8b16 /core/Date.php | |
parent | 1092e4d7290333591f0f9beead6580a1424bc99f (diff) |
Changes to support custom periods (#11837)
* Separate Archive query creation responsibility from Archive class.
* Add ability for plugins to define custom period types.
* Make period responsible for determining start/end time of periods, not LogAggregator.
* Allow specifying custom archive writer in PluginsArchiver.
Diffstat (limited to 'core/Date.php')
-rw-r--r-- | core/Date.php | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/core/Date.php b/core/Date.php index 64583c9814..3415af6f95 100644 --- a/core/Date.php +++ b/core/Date.php @@ -178,17 +178,34 @@ class Date } /** + * @return string + * @deprecated + */ + public function getDateStartUTC() + { + return $this->getStartOfDay()->toString(self::DATE_TIME_FORMAT); + } + + /** * Returns the start of the day of the current timestamp in UTC. For example, * if the current timestamp is `'2007-07-24 14:04:24'` in UTC, the result will - * be `'2007-07-24'`. + * be `'2007-07-24'` as a Date. * - * @return string + * @return Date */ - public function getDateStartUTC() + public function getStartOfDay() { $dateStartUTC = gmdate('Y-m-d', $this->timestamp); - $date = Date::factory($dateStartUTC)->setTimezone($this->timezone); - return $date->toString(self::DATE_TIME_FORMAT); + return Date::factory($dateStartUTC)->setTimezone($this->timezone); + } + + /** + * @return string + * @deprecated + */ + public function getDateEndUTC() + { + return $this->getEndOfDay()->toString(self::DATE_TIME_FORMAT); } /** @@ -196,13 +213,12 @@ class Date * if the current timestamp is `'2007-07-24 14:03:24'` in UTC, the result will * be `'2007-07-24 23:59:59'`. * - * @return string + * @return Date */ - public function getDateEndUTC() + public function getEndOfDay() { $dateEndUTC = gmdate('Y-m-d 23:59:59', $this->timestamp); - $date = Date::factory($dateEndUTC)->setTimezone($this->timezone); - return $date->toString(self::DATE_TIME_FORMAT); + return Date::factory($dateEndUTC)->setTimezone($this->timezone); } /** |