イベントを取得
@method getEvents
@param  {DATE}  date
@return {Array} events
329019
function getEvents (date) {
  date = this.toDate(date);
  if (!date) {
    return null;
  }
  var info = getDayInfo(this.dayInfo, date);
  return info ? info.events : [];
}
913927
public static Calendar toCalendar(final Date date) {
        final Calendar c = Calendar.getInstance();
        c.setTime(date);
        return c;
    }
1178224
def dates(event, date_range)
      result=[]
      date_range.each do |date|
        result.push date if include?(event,date)
      end
      result
    end
382692
function (events)
		{
			var event = {};
			for (e in events)
			{
				var ref=events[e],
					e = 'event-'+e.replace('-','.');
				event[e]=ref;
				event[e].class=ref.class || 'wnEvent';
				event[e].eventName = e.split('-').pop();
				if (this.hasEvent(e))
				{
					_.merge(event[e],this.getEvent(e));
				}
				_eventsConfig[e]=_eventsConfig[e] || {};
				_.merge(_eventsConfig[e], event[e]);
			}
			return this;
		}
118027
private static Calendar buildCalendar(final Date date) {

    Calendar calendar = buildCalendar();
    calendar.setTime(date);
    return calendar;
  }
127367
function(date, h) {
        var copiedDate = new Date(date.getTime());
        copiedDate.setHours(copiedDate.getHours()+h);
        return copiedDate;
    }
588977
public function getEvents()
    {
        if (empty($this->events)) {
            return [];
        }

        $events = call_user_func_array('array_merge', $this->events);

        foreach ($events as &$e) {
            if (!$e['timestamp'] instanceof \DateTime) {
                $dt             = new DateTimeHelper($e['timestamp'], 'Y-m-d H:i:s', 'UTC');
                $e['timestamp'] = $dt->getDateTime();
                unset($dt);
            }
        }

        if (!empty($this->orderBy)) {
            usort(
                $events,
                function ($a, $b) {
                    switch ($this->orderBy[0]) {
                        case 'eventLabel':
                            $aLabel = '';
                            if (isset($a['eventLabel'])) {
                                $aLabel = (is_array($a['eventLabel'])) ? $a['eventLabel']['label'] : $a['eventLabel'];
                            }

                            $bLabel = '';
                            if (isset($b['eventLabel'])) {
                                $bLabel = (is_array($b['eventLabel'])) ? $b['eventLabel']['label'] : $b['eventLabel'];
                            }

                            return strnatcmp($aLabel, $bLabel);

                        case 'date_added':
                            if ($a['timestamp'] == $b['timestamp']) {
                                $aPriority = isset($a['eventPriority']) ? (int) $a['eventPriority'] : 0;
                                $bPriority = isset($b['eventPriority']) ? (int) $b['eventPriority'] : 0;

                                return $aPriority - $bPriority;
                            }

                            return $a['timestamp'] < $b['timestamp'] ? -1 : 1;

                        case 'contact_id':
                            if ($a['contactId'] == $b['contactId']) {
                                return 0;
                            }

                            return $a['contactId'] < $b['contactId'] ? -1 : 1;

                        case 'type':

                            return strnatcmp($a['eventType'], $b['eventType']);

                        default:

                            return strnatcmp($a[$this->orderBy[0]], $b[$this->orderBy[0]]);
                    }
                }
            );

            if ('DESC' == $this->orderBy[1]) {
                $events = array_reverse($events);
            }
        }

        return $events;
    }
1216526
function tableFromEvents(eventsObj) {
  const headers = ["Event Name", "Type", "Description"]
  let rows = []

  for(const evt in eventsObj) {
    let cols = []

    cols.push(`${evt}`) // event name
    
    let typeList = ''
    eventsObj[evt]["type"]["names"].forEach((type, idx, arr) => {
      typeList += `${type}${arr[idx+1] ? `|` : ''}`
    })
    cols.push(typeList) // list of event types
    cols.push(`${eventsObj[evt]["description"]}`) // description of the event

    rows.push(cols);
  }

  return rows.length > 0 ? {table: {headers, rows}} : null
}
253858
def get_events(object_key: str) -> List[Event]:
    """"""
    events_data = _get_events_data(object_key)
    return [Event.from_config(event_dict) for event_dict in events_data]
701925
function isOpen (date) {
  date = this.toDate(date);
  if (!date) {
    return null;
  }

  // 臨時営業・臨時休業
  var info = getDayInfo(this.dayInfo, date);
  if (info) {
    if (info.open) {
      return true;
    } else if (info.close) {
      return false;
    }
  }

  // 定休日判定
  if (this.isRegularHoliday(date)) {
    return false;
  }

  // 年末年始・お盆等の休みの判定
  if (this.isSeasonHoliday(date)) {
    return false;
  }

  // 祝日判定
  if (this.isHolidayClose(date)) {
    return false;
  }

  return true;
}
1249461
def _getEventsByDay(self, request, firstDay, lastDay):
        
        home = request.site.root_page
        return getAllEventsByDay(request, firstDay, lastDay, home=home)
767805
function(date) {
        var dateNoTime = new Date(
            date.getFullYear(), date.getMonth(), date.getDate());
        return Math.ceil(
            (dateNoTime - new Date(date.getFullYear(), 0, 1))
            / dateutil.ONE_DAY) + 1;
    }
153977
function removeEvent (date, index) {
  date = this.toDate(date);
  if (!date) {
    return false;
  }
  var info = getDayInfo(this.dayInfo, date);
  if (!info) {
    return false;
  }
  var events = info.events;
  if (arguments.length === 1) {
    events.splice(0, events.length);
    return true;
  }
  if (events.length <= index) {
    return false;
  }
  events.splice(index,1);
  return true;
}
742232
function generateEvents(boxes) {
	var events = new Array();
	var event = new Object();
	
	for (i = 0; i < boxes.length; i++) {  // traverse the list of boxes
		var leftx = Math.min(boxes[i][0][0], boxes[i][1][0]);
		var rightx = Math.max(boxes[i][0][0], boxes[i][1][0]);
		
		event = new Object();
		event.x = leftx;
		event.type = "add";
		event.index = i;
		events.unshift(event);
		
		event = new Object();
		event.x = rightx;
		event.type = "remove";
		event.index = i;
		events.push(event);
	}
	return events;
}
1141146
function (date) {
            var evt = {
                date : date,
                cancelDefault : false
            };
            this.evalCallback(this._cfg.onDateSelect, evt);
            if (evt.cancelDefault !== true) {
                var cfg = this._cfg;
                var dateToChange = this._dateToChange;
                var dateToKeep = this._dateToKeep;
                var properties = {};
                var tmp;
                properties[dateToChange] = date;
                properties[dateToKeep] = cfg[dateToKeep];
                if (properties.fromDate > properties.toDate) {
                    tmp = properties.fromDate;
                    properties.fromDate = properties.toDate;
                    properties.toDate = tmp;
                } else {
                    tmp = dateToKeep;
                    dateToKeep = dateToChange;
                    dateToChange = tmp;
                }
                this.setProperty("fromDate", properties.fromDate);
                this.setProperty("toDate", properties.toDate);
                this._dateToChange = dateToChange;
                this._dateToKeep = dateToKeep;
                this._subTplModuleCtrl.setRanges(this._getRanges());
                this.evalCallback(cfg.onchange);
            }
        }
742754
public Date toDate(Object date) {

        Date d = null;
        if (null != date) {
            if (date instanceof Date) {
                d = (Date)date;
            } else if (date instanceof Long) {
                d = new Date(((Long)date).longValue());
            } else {
                try {
                    long l = Long.parseLong(date.toString());
                    d = new Date(l);
                } catch (Exception e) {
                    // do nothing, just let d remain null
                }
            }
        }
        return d;
    }
497262
function(date) {
      if (_.isDate(date)) {
        this._date = date.toSerialNumber();
      } else if (_.isNumber(date)) {
        this._date = date;
      } else {
        throw new CError('wrong date type').log();
      }
    }