Skip to content

Commit

Permalink
Merge pull request #24 from opencafe/feature/fix-add-date
Browse files Browse the repository at this point in the history
Fix jalali day of week return problem
  • Loading branch information
shahrokhniakan authored Sep 2, 2017
2 parents 523245f + 083190e commit 1b2741c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Datium.php
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,8 @@ public function add($value)
new DateInterval($this->date_interval_expression)
);

$this->gregorian_DayofWeek = $this->date_time->format('w');

return $this;

}
Expand Down
8 changes: 8 additions & 0 deletions tests/DatiumTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,4 +260,12 @@ public function testJalaliSubDateTime()

$this->assertEquals("Panjshanbe 9th Shahrivar 1396 12:00:00", $jalali);
}

public function testJalaliAddDateTime()
{
$jalali = Datium::create(2017, 9, 1, 12, 0, 0)->add('1 day')->to('jalali')
->get('l jS F Y h:i:s');

$this->assertEquals("Shanbe 11th Shahrivar 1396 12:00:00", $jalali);
}
}

0 comments on commit 1b2741c

Please sign in to comment.