Browse Source

Start integrating chronos.

* Update composer.json
* Remove methods defined in chronos.
Mark Story 10 years ago
parent
commit
637eb9e944
2 changed files with 3 additions and 33 deletions
  1. 1 1
      composer.json
  2. 2 32
      src/I18n/Time.php

+ 1 - 1
composer.json

@@ -21,7 +21,7 @@
         "php": ">=5.5.0",
         "ext-intl": "*",
         "ext-mbstring": "*",
-        "nesbot/Carbon": "1.13.*",
+        "cakephp/chronos": "~1.0",
         "aura/intl": "1.1.*",
         "psr/log": "1.0"
     },

+ 2 - 32
src/I18n/Time.php

@@ -14,7 +14,7 @@
  */
 namespace Cake\I18n;
 
-use Carbon\Carbon;
+use Cake\Chronos\Chronos;
 use DateTime;
 use DateTimeZone;
 use IntlDateFormatter;
@@ -25,7 +25,7 @@ use JsonSerializable;
  * formatting helpers
  *
  */
-class Time extends Carbon implements JsonSerializable
+class Time extends Chronos implements JsonSerializable
 {
 
     /**
@@ -159,36 +159,6 @@ class Time extends Carbon implements JsonSerializable
     }
 
     /**
-     * Returns true if this object represents a date within the current week
-     *
-     * @return bool
-     */
-    public function isThisWeek()
-    {
-        return static::now($this->getTimezone())->format('W o') == $this->format('W o');
-    }
-
-    /**
-     * Returns true if this object represents a date within the current month
-     *
-     * @return bool
-     */
-    public function isThisMonth()
-    {
-        return static::now($this->getTimezone())->format('m Y') == $this->format('m Y');
-    }
-
-    /**
-     * Returns true if this object represents a date within the current year
-     *
-     * @return bool
-     */
-    public function isThisYear()
-    {
-        return static::now($this->getTimezone())->format('Y') == $this->format('Y');
-    }
-
-    /**
      * Returns the quarter
      *
      * @param bool $range Range.