public function Form()
 {
     $fields = new FieldList();
     $source = array();
     $fields->push(new HeaderField('Header', _t('RemoveOrphanedPagesTask.HEADER', 'Remove all orphaned pages task')));
     $fields->push(new LiteralField('Description', $this->description));
     $orphans = $this->getOrphanedPages($this->orphanedSearchClass);
     if ($orphans) {
         foreach ($orphans as $orphan) {
             $latestVersion = Versioned::get_latest_version($this->orphanedSearchClass, $orphan->ID);
             $latestAuthor = DataObject::get_by_id('Member', $latestVersion->AuthorID);
             $stageRecord = Versioned::get_one_by_stage($this->orphanedSearchClass, 'Stage', sprintf("\"%s\".\"ID\" = %d", ClassInfo::baseDataClass($this->orphanedSearchClass), $orphan->ID));
             $liveRecord = Versioned::get_one_by_stage($this->orphanedSearchClass, 'Live', sprintf("\"%s\".\"ID\" = %d", ClassInfo::baseDataClass($this->orphanedSearchClass), $orphan->ID));
             $label = sprintf('<a href="admin/pages/edit/show/%d">%s</a> <small>(#%d, Last Modified Date: %s, Last Modifier: %s, %s)</small>', $orphan->ID, $orphan->Title, $orphan->ID, Date::create($orphan->LastEdited)->Nice(), $latestAuthor ? $latestAuthor->Title : 'unknown', $liveRecord ? 'is published' : 'not published');
             $source[$orphan->ID] = $label;
         }
     }
     if ($orphans && $orphans->Count()) {
         $fields->push(new CheckboxSetField('OrphanIDs', false, $source));
         $fields->push(new LiteralField('SelectAllLiteral', sprintf('<p><a href="#" onclick="javascript:jQuery(\'#Form_Form_OrphanIDs :checkbox\').attr(\'checked\', \'checked\'); return false;">%s</a>&nbsp;', _t('RemoveOrphanedPagesTask.SELECTALL', 'select all'))));
         $fields->push(new LiteralField('UnselectAllLiteral', sprintf('<a href="#" onclick="javascript:jQuery(\'#Form_Form_OrphanIDs :checkbox\').attr(\'checked\', \'\'); return false;">%s</a></p>', _t('RemoveOrphanedPagesTask.UNSELECTALL', 'unselect all'))));
         $fields->push(new OptionSetField('OrphanOperation', _t('RemoveOrphanedPagesTask.CHOOSEOPERATION', 'Choose operation:'), array('rebase' => _t('RemoveOrphanedPagesTask.OPERATION_REBASE', sprintf('Rebase selected to a new holder page "%s" and unpublish. None of these pages will show up for website visitors.', $this->rebaseHolderTitle())), 'remove' => _t('RemoveOrphanedPagesTask.OPERATION_REMOVE', 'Remove selected from all stages (WARNING: Will destroy all selected pages from both stage and live)')), 'rebase'));
         $fields->push(new LiteralField('Warning', sprintf('<p class="message">%s</p>', _t('RemoveOrphanedPagesTask.DELETEWARNING', 'Warning: These operations are not reversible. Please handle with care.'))));
     } else {
         $fields->push(new LiteralField('NotFoundLabel', sprintf('<p class="message">%s</p>', _t('RemoveOrphanedPagesTask.NONEFOUND', 'No orphans found'))));
     }
     $form = new Form($this, 'Form', $fields, new FieldList(new FormAction('doSubmit', _t('RemoveOrphanedPagesTask.BUTTONRUN', 'Run'))));
     if (!$orphans || !$orphans->Count()) {
         $form->makeReadonly();
     }
     return $form;
 }
Example #2
0
 function fromDOMtoDB($domValue)
 {
     if (empty($domValue)) {
         $domValue = Date::create(0);
     }
     return $domValue->format("%Y-%m-%d %H:%M:%S");
 }
 public function __construct(Date $base, $weekStart = Timestamp::WEEKDAY_MONDAY)
 {
     $firstDayOfMonth = Date::create($base->getYear() . '-' . $base->getMonth() . '-01');
     $lastDayOfMonth = Date::create($base->getYear() . '-' . $base->getMonth() . '-' . date('t', $base->toStamp()));
     $start = $firstDayOfMonth->getFirstDayOfWeek($weekStart);
     $end = $lastDayOfMonth->getLastDayOfWeek($weekStart);
     $this->monthRange = DateRange::create()->lazySet($firstDayOfMonth, $lastDayOfMonth);
     $this->fullRange = DateRange::create()->lazySet($start, $end);
     $rawDays = $this->fullRange->split();
     $this->fullLength = 0;
     foreach ($rawDays as $rawDay) {
         $day = CalendarDay::create($rawDay->toStamp());
         if ($this->monthRange->contains($day)) {
             $day->setOutside(false);
         } else {
             $day->setOutside(true);
         }
         $this->days[$day->toDate()] = $day;
         $weekNumber = floor($this->fullLength / 7);
         if (!isset($this->weeks[$weekNumber])) {
             $this->weeks[$weekNumber] = CalendarWeek::create();
         }
         $this->weeks[$weekNumber]->addDay($day);
         ++$this->fullLength;
     }
     ++$this->fullLength;
 }
 /**
  * Returns a list of months where blog posts are present.
  *
  * @return DataList
  */
 public function getArchive()
 {
     $query = $this->Blog()->getBlogPosts()->dataQuery();
     if ($this->ArchiveType == 'Yearly') {
         $query->groupBy('DATE_FORMAT("PublishDate", \'%Y\')');
     } else {
         $query->groupBy('DATE_FORMAT("PublishDate", \'%Y-%M\')');
     }
     $posts = $this->Blog()->getBlogPosts()->setDataQuery($query);
     if ($this->NumberToDisplay > 0) {
         $posts = $posts->limit($this->NumberToDisplay);
     }
     $archive = new ArrayList();
     if ($posts->count() > 0) {
         foreach ($posts as $post) {
             /**
              * @var BlogPost $post
              */
             $date = Date::create();
             $date->setValue($post->PublishDate);
             if ($this->ArchiveType == 'Yearly') {
                 $year = $date->FormatI18N("%Y");
                 $month = null;
                 $title = $year;
             } else {
                 $year = $date->FormatI18N("%Y");
                 $month = $date->FormatI18N("%m");
                 $title = $date->FormatI18N("%B %Y");
             }
             $archive->push(new ArrayData(array('Title' => $title, 'Link' => Controller::join_links($this->Blog()->Link('archive'), $year, $month))));
         }
     }
     return $archive;
 }
 public function testDateNow()
 {
     try {
         Date::create('now');
     } catch (WrongArgumentException $e) {
         $this->fail($e->getMessage());
     }
 }
  function testGetDayOfWeek()
  {
    $date = Date ::create($year = 2005, $month = 1, $day=20, $hour=10, $minute=15, $second=30);

    $formated_date = $date->getDayOfWeek();

    $expected = 'Thursday';
    $this->assertEqual($formated_date, 4);
  }
 public function __construct($startDate = null, $holidayArray = array())
 {
     if ($startDate) {
         $this->startDate = $startDate;
     } else {
         $this->startDate = Date::create();
     }
     $this->holidays = $holidayArray;
 }
 public function testDialectStringObjects()
 {
     $criteria = Criteria::create(TestUser::dao())->setProjection(Projection::property('id'))->add(Expression::gt('registered', Date::create('2011-01-01')));
     $this->assertEquals($criteria->toDialectString(ImaginaryDialect::me()), 'SELECT test_user.id FROM test_user WHERE (test_user.registered > 2011-01-01)');
     $criteria = Criteria::create(TestUserWithContactExtended::dao())->setProjection(Projection::property('contactExt.city.id', 'cityId'))->add(Expression::eq('contactExt.city', TestCity::create()->setId(22)));
     $this->assertEquals($criteria->toDialectString(ImaginaryDialect::me()), 'SELECT test_user_with_contact_extended.city_id AS cityId FROM test_user_with_contact_extended WHERE (test_user_with_contact_extended.city_id = 22)');
     $cityList = array(TestCity::create()->setId(3), TestCity::create()->setId(44));
     $criteria = Criteria::create(TestUser::dao())->setProjection(Projection::property('id'))->add(Expression::in('city', $cityList));
     $this->assertEquals($criteria->toDialectString(ImaginaryDialect::me()), 'SELECT test_user.id FROM test_user WHERE (test_user.city_id IN (3, 44))');
 }
 public function testSafeValues()
 {
     $prm = Primitive::date('date');
     $date = Date::create('2005-02-19');
     $prm->import(array('date' => '2005-02-19'));
     $this->assertTrue($prm->isImported());
     $this->assertTrue($prm->getSafeValue() == $date);
     $prm = Primitive::date('date')->setDefault($date);
     $prm->import(array('date' => 'omgEvilInput'));
     $this->assertTrue($prm->isImported());
     $this->assertTrue($prm->getSafeValue() === null);
 }
Example #10
0
 /**
  * @return int
  * @param string|Date|DateTime $date
  */
 public function daysTo($date)
 {
     $from = Date::create($this);
     $to = Date::create($date);
     $from->setTime(0, 0, 0);
     $to->setTime(0, 0, 0);
     $diff = abs($to->format('U') - $from->format('U'));
     if (0 === $diff) {
         return 1;
     }
     $diff = round($diff / self::ONE_DAY);
     return $diff;
 }
  function testDefinedFormat()
  {
    $date = Date ::create($year = 2005, $month = 1, $day=20, $hour=10, $minute=15, $second=30);

    $template = '<limb:locale:DATE locale="en" date_type="stamp" format="%Y %m %d">'.
                $date->getStamp().
                '</limb:locale:DATE>';

    RegisterTestingTemplate('/limb/locale_date_defined_format.html', $template);

    $page =& new Template('/limb/locale_date_defined_format.html');

    $this->assertEqual($page->capture(), '2005 01 20');
  }
Example #12
0
 public function testGettingDiffDays()
 {
     $this->assertEquals(1, Date::create('2009-01-01')->daysTo('2009-01-01'));
     $this->assertEquals(1, Date::create('2009-01-01 00:00:00')->daysTo('2009-01-01 23:59:59'));
     $this->assertEquals(1, Date::create('2009-01-01 23:59:59')->daysTo('2009-01-01 23:59:59'));
     $this->assertEquals(1, Date::create('2009-01-01')->daysTo('2009-01-02'));
     $this->assertEquals(1, Date::create('2009-01-01 00:00:00')->daysTo('2009-01-02 23:59:59'));
     $this->assertEquals(1, Date::create('2009-01-01 23:59:59')->daysTo('2009-01-02 23:59:59'));
     $date = Date::create('2009-01-01');
     $test = Date::create('2009-01-01');
     for ($i = 1; $i <= 365; $i++) {
         $test->modify('+1 day');
         $this->assertEquals($i, $date->daysTo($test), $test->toSql('mysql') . ' ' . $date->toSql('mysql'));
     }
 }
 public static function makeDatesListByRange(DateRange $range, IntervalUnit $unit, $hash = true)
 {
     $date = $unit->truncate($range->getStart());
     if ('Date' == get_class($range->getStart())) {
         $date = Date::create($date->toStamp());
     }
     $dates = array();
     do {
         if ($hash) {
             $dates[$date->toString()] = $date;
         } else {
             $dates[] = $date;
         }
         $date = $date->spawn('+ 1' . $unit->getName());
     } while ($range->getEnd()->toStamp() >= $date->toStamp());
     return $dates;
 }
 /**
  * Read from a file
  *
  * @deprecated  Use img.io.MetaDataReader instead
  * @param   io.File file
  * @param   var default default void what should be returned in case no data is found
  * @return  img.util.IptcData
  * @throws  lang.FormatException in case malformed meta data is encountered
  * @throws  lang.ElementNotFoundException in case no meta data is available
  * @throws  img.ImagingException in case reading meta data fails
  */
 public static function fromFile(File $file)
 {
     if (FALSE === getimagesize($file->getURI(), $info)) {
         $e = new ImagingException('Cannot read image information from ' . $file->getURI());
         xp::gc(__FILE__);
         throw $e;
     }
     if (!isset($info['APP13'])) {
         if (func_num_args() > 1) {
             return func_get_arg(1);
         }
         throw new ElementNotFoundException('Cannot get IPTC information from ' . $file->getURI() . ' (no APP13 marker)');
     }
     if (!($iptc = iptcparse($info['APP13']))) {
         throw new FormatException('Cannot parse IPTC information from ' . $file->getURI());
     }
     // Parse creation date
     if (3 == sscanf(@$iptc['2#055'][0], '%4d%2d%d', $year, $month, $day)) {
         $created = Date::create($year, $month, $day, 0, 0, 0);
     } else {
         $created = NULL;
     }
     with($i = new self());
     $i->setTitle(@$iptc['2#005'][0]);
     $i->setUrgency(@$iptc['2#010'][0]);
     $i->setCategory(@$iptc['2#015'][0]);
     $i->setSupplementalCategories(@$iptc['2#020']);
     $i->setKeywords(@$iptc['2#025']);
     $i->setSpecialInstructions(@$iptc['2#040'][0]);
     $i->setDateCreated($created);
     $i->setAuthor(@$iptc['2#080'][0]);
     $i->setAuthorPosition(@$iptc['2#085'][0]);
     $i->setCity(@$iptc['2#090'][0]);
     $i->setState(@$iptc['2#095'][0]);
     $i->setCountry(@$iptc['2#101'][0]);
     $i->setOriginalTransmissionReference(@$iptc['2#103'][0]);
     $i->setHeadline(@$iptc['2#105'][0]);
     $i->setCredit(@$iptc['2#110'][0]);
     $i->setSource(@$iptc['2#115'][0]);
     $i->setCopyrightNotice(@$iptc['2#116'][0]);
     $i->setCaption(@$iptc['2#120'][0]);
     $i->setWriter(@$iptc['2#122'][0]);
     return $i;
 }
Example #15
0
 /**
  * Cast a given value
  *
  * @see     xp://scriptlet.xml.workflow.casters.ParamCaster
  * @param   array value
  * @return  array value
  */
 public function castValue($value)
 {
     $return = array();
     foreach ($value as $k => $v) {
         if ('' === $v) {
             return 'empty';
         }
         $pv = call_user_func(self::$parse, $v);
         if (!is_int($pv['year']) || !is_int($pv['month']) || !is_int($pv['day']) || 0 < $pv['warning_count'] || 0 < $pv['error_count']) {
             return 'invalid';
         }
         try {
             $date = Date::create($pv['year'], $pv['month'], $pv['day'], $pv['hour'], $pv['minute'], $pv['second']);
         } catch (IllegalArgumentException $e) {
             return $e->getMessage();
         }
         $return[$k] = $date;
     }
     return $return;
 }
 public function countInRange(DateRange $range, $overlappedBounds = true)
 {
     $range = $range->toTimestampRange();
     $start = $this->truncate($range->getStart(), !$overlappedBounds);
     $end = $this->truncate($range->getEnd(), $overlappedBounds);
     if ($this->seconds) {
         $result = ($end->toStamp() - $start->toStamp()) / $this->seconds;
     } elseif ($this->days) {
         $epochStartTruncated = Date::create('1970-01-05');
         $startDifference = Date::dayDifference($epochStartTruncated, Date::create($start->toDate()));
         $endDifference = Date::dayDifference($epochStartTruncated, Date::create($end->toDate()));
         $result = ($endDifference - $startDifference) / $this->days;
     } elseif ($this->months) {
         $startMonthsCount = $start->getYear() * 12 + ($start->getMonth() - 1);
         $endMonthsCount = $end->getYear() * 12 + ($end->getMonth() - 1);
         $result = ($endMonthsCount - $startMonthsCount) / $this->months;
     }
     Assert::isEqual($result, (int) $result, 'floating point mistake, arguments: ' . $this->name . ', ' . $start->toStamp() . ', ' . $end->toStamp() . ', ' . 'result: ' . var_export($result, true));
     return (int) $result;
 }
 /**
  * Get last modified date. Uses the "MDTM" command internally.
  *
  * @return  util.Date or NULL if the server does not support this
  * @throws  io.IOException in case the connection is closed
  */
 public function lastModified()
 {
     $r = $this->connection->sendCommand('MDTM %s', $this->name);
     sscanf($r[0], "%d %[^\r\n]", $code, $message);
     if (213 === $code) {
         sscanf($message, '%4d%02d%02d%02d%02d%02d', $y, $m, $d, $h, $i, $s);
         // YYYYMMDDhhmmss
         return Date::create($y, $m, $d, $h, $i, $s);
     } else {
         if (550 === $code) {
             return NULL;
         } else {
             throw new ProtocolException('MDTM: Unexpected response ' . $code . ': ' . $message);
         }
     }
 }
Example #18
0
 public function dateCreateWithInvalidArgumentsExceptTimeZone()
 {
     Date::create('', '', '', '', '', '', new TimeZone('UTC'));
 }
 /**
  * Returns false if the content review have disabled.
  *
  * @param SiteTree $page
  *
  * @return bool|Date
  */
 public function getReviewDate(SiteTree $page = null)
 {
     if ($page === null) {
         $page = $this->owner;
     }
     if ($page->obj("NextReviewDate")->exists()) {
         return $page->obj("NextReviewDate");
     }
     $options = $this->owner->getOptions();
     if (!$options) {
         return false;
     }
     if (!$options->ReviewPeriodDays) {
         return false;
     }
     // Failover to check on ReviewPeriodDays + LastEdited
     $nextReviewUnixSec = strtotime(" + " . $options->ReviewPeriodDays . " days", SS_Datetime::now()->format("U"));
     $date = Date::create("NextReviewDate");
     $date->setValue(date("Y-m-d H:i:s", $nextReviewUnixSec));
     return $date;
 }
 /**
  * Get easter date for given year
  *
  * @param   int year default -1 Year, defaults to this year
  * @return  util.Date date for Easter date
  * @see     http://www.koenigsmuenster.de/rsk/epakte.htm
  * @see     http://www.salesianer.de/util/kalfaq.html
  * @see     php://easter-date#user_contrib
  */
 public static function easter($year = -1)
 {
     if (-1 == $year) {
         $year = date('Y');
     }
     $g = $year % 19;
     $c = (int) ($year / 100);
     $h = (int) ($c - $c / 4 - (8 * $c + 13) / 25 + 19 * $g + 15) % 30;
     $i = (int) $h - (int) ($h / 28) * (1 - (int) ($h / 28) * (int) (29 / ($h + 1)) * ((int) (21 - $g) / 11));
     $j = ($year + (int) ($year / 4) + $i + 2 - $c + (int) ($c / 4)) % 7;
     $l = $i - $j;
     $m = 3 + (int) (($l + 40) / 44);
     $d = $l + 28 - 31 * (int) ($m / 4);
     return Date::create($year, $m, $d, 0, 0, 0);
 }
Example #21
0
 public function plusDays($nbDays)
 {
     return Date::create($this->time + $nbDays * 24 * 60 * 60);
 }
 /**
  * 
  * @return string
  */
 public function getExpireHTML()
 {
     if (!$this->owner->Secured) {
         return;
     }
     if ($this->owner instanceof Folder) {
         $ret = "N/A";
     } else {
         switch ($this->owner->ExpiryType) {
             case 'AtAFixedDate':
                 if ($expireDate = $this->owner->ExpireAtDate) {
                     $datetime = new SS_Datetime();
                     $datetime->setValue($expireDate);
                     $now = $today = date('Y-m-d H:i:s');
                     if ($expireDate > $now) {
                         $expire = _t("FileSecured.EmbargoedNotExpired", "Not expired, will expire ");
                     } else {
                         $expire = _t("FileSecured.EmbargoedExpired", "Expired ");
                     }
                     $time = Time::create();
                     $time->setValue($datetime->Time());
                     $date = Date::create();
                     $date->setValue($datetime->Date());
                     $ret = $expire . " at " . $time->Nice() . ", " . $date->Long();
                 } else {
                     $ret = _t("FileSecured.EmbargoedNoDateSetNotExpired", "No embargoing date/time is set, so treated as not expired");
                 }
                 break;
             default:
                 //case 'None':
                 $ret = "Not expired";
         }
     }
     return $ret;
 }
Example #23
0
 /**
  * Set a given timezone for the passed date. Really modifies
  * the date as just the timezone is exchanged, no further
  * modifications are done.
  *
  * @param   util.Date date
  * @param   util.TimeZone tz
  * @return  util.Date
  */
 public static function setTimezone(Date $date, TimeZone $tz)
 {
     return Date::create($date->getYear(), $date->getMonth(), $date->getDay(), $date->getHours(), $date->getMinutes(), $date->getSeconds(), $tz);
 }
Example #24
0
 /**
  * Convert days and seconds since 01.01.1900 to a date
  *
  * @param   int days
  * @param   int seconds
  * @return  string
  */
 protected function toDate($days, $seconds)
 {
     return Date::create(1900, 1, 1 + $days, 0, 0, $seconds / 300);
 }
 public function testMakeFromWeek()
 {
     $this->makeFromWeekTest(Date::create('2009-12-28'));
     $this->makeFromWeekTest(Date::create('2010-01-04'));
     return $this;
 }
 /** @return Date */
 public function dateReturn()
 {
     $part = getdate();
     // Always winter hour
     return Date::create(mktime(0, 0, 0, $part['mon'], $part['mday'], $part['year']));
 }
 public function testSetTimezone()
 {
     $this->assertEquals(Date::create(2000, 1, 1, 17, 15, 11, new TimeZone('GMT')), DateUtil::setTimeZone($this->fixture, new TimeZone('America/New_York')));
 }
 /**
  * Creates a date from DOS date and time
  *
  * @see     http://www.vsft.com/hal/dostime.htm
  * @param   int date
  * @param   int time
  * @return  util.Date
  */
 protected function dateFromDosDateTime($date, $time)
 {
     return Date::create(($date >> 9 & 0x7f) + 1980, $date >> 5 & 0xf, $date & 0x1f, $time >> 11 & 0x1f, $time >> 5 & 0x3f, $time << 1 & 0x1e);
 }
 /**
  * Parses an input string
  *
  * @param   string in
  * @return  util.Date
  */
 public function parse($in)
 {
     $o = 0;
     $m = $tz = $go = NULL;
     $il = strlen($in);
     $parsed = array('year' => 0, 'month' => 0, 'day' => 0, 'hour' => 0, 'minute' => 0, 'second' => 0);
     foreach ($this->format as $token) {
         switch ($token) {
             case '%Y':
                 $parsed['year'] = $this->parseNumber($in, 4, $o);
                 $o += 4;
                 break;
             case '%m':
                 $parsed['month'] = $this->parseNumber($in, 2, $o);
                 $o += 2;
                 break;
             case '%d':
                 $parsed['day'] = $this->parseNumber($in, 2, $o);
                 $o += 2;
                 break;
             case '%H':
                 $parsed['hour'] = $this->parseNumber($in, 2, $o);
                 $o += 2;
                 break;
             case '%M':
                 $parsed['minute'] = $this->parseNumber($in, 2, $o);
                 $o += 2;
                 break;
             case '%S':
                 $parsed['second'] = $this->parseNumber($in, 2, $o);
                 $o += 2;
                 break;
             case '%p':
                 $m = substr($in, $o, 2);
                 $o += 2;
                 break;
             case '%I':
                 $parsed['hour'] = $this->parseNumber($in, 2, $o);
                 $o += 2;
                 break;
             case '%z':
                 $tz = new TimeZone($n = substr($in, $o, strcspn($in, ' ', $o)));
                 $o += strlen($n);
                 break;
             case '%Z':
                 sscanf(substr($in, $o, 5), '%c%02d%02d', $sign, $hours, $minutes);
                 $fa = '-' === $sign ? 1 : -1;
                 // -0800 means 8 hours ahead of time
                 $go = array('hour' => $fa * $hours, 'minute' => $fa * $minutes);
                 $tz = new TimeZone('GMT');
                 $o += 5;
                 break;
             case is_array($token):
                 foreach ($token[1] as $i => $value) {
                     if ($value !== substr($in, $o, strlen($value))) {
                         continue;
                     }
                     $parsed[$token[0]] = $i + 1;
                     $o += strlen($value);
                     break 2;
                 }
                 throw new FormatException('Expected [' . implode(', ', $token[1]) . '] but have "' . substr($in, $o, 5) . '..."');
             default:
                 if ($o >= $il) {
                     throw new FormatException('Not enough input at offset ' . $o);
                 }
                 if ($token !== $in[$o]) {
                     throw new FormatException('Expected "' . $token . '" but have "' . $in[$o] . '" at offset ' . $o);
                 }
                 $o++;
         }
     }
     // AM/PM calculation
     if ('AM' === $m && 12 === $parsed['hour']) {
         $parsed['hour'] = 0;
     } else {
         if ('PM' === $m && 12 !== $parsed['hour']) {
             $parsed['hour'] += 12;
         }
     }
     // Timezone offset calculationn
     if ($go) {
         $parsed['hour'] += $go['hour'];
         $parsed['minute'] += $go['minute'];
     }
     // echo "$in => "; var_dump($parsed);
     return Date::create($parsed['year'], $parsed['month'], $parsed['day'], $parsed['hour'], $parsed['minute'], $parsed['second'], $tz);
 }
 public function testOverlaps()
 {
     $this->assertTrue(DateRange::create()->lazySet(Date::create('2007-03-28'), Date::create('2008-03-27'))->overlaps(DateRange::create()->lazySet(Date::create('2007-05-14'), Date::create('2008-03-29'))));
     $this->assertFalse(DateRange::create()->lazySet(Date::create('2007-03-28'), Date::create('2008-03-27'))->overlaps(DateRange::create()->lazySet(Date::create('2005-05-14'), Date::create('2006-03-29'))));
 }