Ejemplo n.º 1
0
 /**
  * @param JalaliDate $jDate
  * @return DateTime
  */
 public static function jalaliToDateTime(JalaliDate $jDate)
 {
     $firstDay = (new GeorgianDate(622, 3, 22))->toInteger();
     $nDays = $jDate->toInteger() + $firstDay;
     $georgian = GeorgianDate::fromInteger($nDays);
     return static::georgianToDateTime($georgian);
 }
Ejemplo n.º 2
0
 /**
  * @param JalaliDate|JDateTime $jDate
  *
  * @return DateTime
  */
 public static function jalaliToDateTime(JalaliDate $jDate)
 {
     $firstDay = (new GeorgianDate(622, 3, 22))->toInteger();
     $nDays = $jDate->toInteger() + $firstDay - 1;
     $georgian = GeorgianDate::fromInteger($nDays);
     $dateTime = static::georgianToDateTime($georgian);
     if ($jDate instanceof JDateTime) {
         $dateTime->setTime($jDate->getHour(), $jDate->getMinute(), $jDate->getSecond());
     }
     return $dateTime;
 }
Ejemplo n.º 3
0
 /**
  * @throws \Exception
  * @test
  * @group brute_force
  */
 public function brute_force_test_from_and_to_integer()
 {
     for ($i = 1; $i < 1039828; $i++) {
         $this->assertEquals($i, GeorgianDate::fromInteger($i)->toInteger());
     }
 }