/**
  * Helper method
  *
  * @param   string input
  * @param   bool lower whether this is the lower boundary
  * @return  util.Date
  */
 protected function parseDate($input, $lower)
 {
     switch ($input) {
         case '__NOW__':
             if ($lower) {
                 $r = DateUtil::getMidnight(Date::now());
             } else {
                 $r = DateUtil::getMidnight(DateUtil::addDays(Date::now(), 1));
             }
             break;
         case '__FUTURE__':
             $r = Date::now();
             break;
         case '__UNLIMITED__':
             $r = NULL;
             break;
         default:
             $r = DateParser::parse($input);
     }
     return $r;
 }
예제 #2
0
 /**
  * Gets the first day of the week, with week starting on sunday
  *
  * @param   util.Date date
  * @return  util.Date
  */
 public static function getBeginningOfWeek(Date $date)
 {
     return DateUtil::addDays(DateUtil::getMidnight($date), -$date->getDayOfWeek());
 }