Skip to content

Commit

Permalink
Merge pull request #90 from cakephp/fix-relative-time
Browse files Browse the repository at this point in the history
Adding today as a relative keyword pattern
  • Loading branch information
markstory committed Mar 21, 2016
2 parents b8970b6 + 4ec5a26 commit 4e1dacb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Traits/RelativeKeywordTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
trait RelativeKeywordTrait
{
protected static $relativePattern = '/this|next|last|tomorrow|yesterday|[+-]|first|last|ago/i';
protected static $relativePattern = '/this|next|last|tomorrow|yesterday|today|[+-]|first|last|ago/i';

/**
* Determine if there is a relative keyword in the time string, this is to
Expand Down
1 change: 1 addition & 0 deletions tests/DateTime/TestingAidsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public function testParseRelativeWithTestValueSet($class)
$this->assertSame('2013-08-25 05:15:05', $class::parse('1 week ago')->toDateTimeString());

$this->assertSame('2013-09-02 00:00:00', $class::parse('tomorrow')->toDateTimeString());
$this->assertSame('2013-09-01 00:00:00', $class::parse('today')->toDateTimeString());
$this->assertSame('2013-08-31 00:00:00', $class::parse('yesterday')->toDateTimeString());

$this->assertSame('2013-09-02 05:15:05', $class::parse('+1 day')->toDateTimeString());
Expand Down

0 comments on commit 4e1dacb

Please sign in to comment.