Skip to content

Commit 1b2741c

Browse files
Merge pull request #24 from opencafe/feature/fix-add-date
Fix jalali day of week return problem
2 parents 523245f + 083190e commit 1b2741c

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

src/Datium.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,8 @@ public function add($value)
434434
new DateInterval($this->date_interval_expression)
435435
);
436436

437+
$this->gregorian_DayofWeek = $this->date_time->format('w');
438+
437439
return $this;
438440

439441
}

tests/DatiumTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,4 +260,12 @@ public function testJalaliSubDateTime()
260260

261261
$this->assertEquals("Panjshanbe 9th Shahrivar 1396 12:00:00", $jalali);
262262
}
263+
264+
public function testJalaliAddDateTime()
265+
{
266+
$jalali = Datium::create(2017, 9, 1, 12, 0, 0)->add('1 day')->to('jalali')
267+
->get('l jS F Y h:i:s');
268+
269+
$this->assertEquals("Shanbe 11th Shahrivar 1396 12:00:00", $jalali);
270+
}
263271
}

0 commit comments

Comments
 (0)