Date when this event last occurred in the local time zone
        (Does not include postponements, but does exclude cancellations)
175291
def prev_date(self):
        
        prevDt = self.__localBefore(timezone.localtime(), dt.time.min)
        if prevDt is not None:
            return prevDt.date()
1157161
def postponed_from(self):
        
        fromDate = getLocalDate(self.except_date, self.time_from, self.tz)
        return dateFormat(fromDate)
629805
def _futureExceptions(self, request):
        
        retval = []
        # We know all future exception dates are in the parent time zone
        myToday = timezone.localdate(timezone=self.tz)

        for extraInfo in ExtraInfoPage.events(request).child_of(self)         \
                                      .filter(except_date__gte=myToday):
            retval.append(extraInfo)
        for cancellation in CancellationPage.events(request).child_of(self)   \
                                            .filter(except_date__gte=myToday):
            postponement = getattr(cancellation, "postponementpage", None)
            if postponement:
                retval.append(postponement)
            else:
                retval.append(cancellation)
        retval.sort(key=attrgetter('except_date'))
        # notice these are events not ThisEvents
        return retval
1268049
def __to_localdatetime(val):
    """"""
    try:
        dt = datetime.strptime(val, __DATE_FORMAT)
        dt = pytz.timezone(__TIMEZONE).localize(dt)
        return dt
    except (ValueError, TypeError):
        return None
95420
function $$core$$ToLocalTime(date, calendar, timeZone) {
        // 1. Apply calendrical calculations on date for the given calendar and time zone to
        //    produce weekday, era, year, month, day, hour, minute, second, and inDST values.
        //    The calculations should use best available information about the specified
        //    calendar and time zone. If the calendar is "gregory", then the calculations must
        //    match the algorithms specified in ES5, 15.9.1, except that calculations are not
        //    bound by the restrictions on the use of best available information on time zones
        //    for local time zone adjustment and daylight saving time adjustment imposed by
        //    ES5, 15.9.1.7 and 15.9.1.8.
        // ###TODO###
        var d = new Date(date),
            m = 'get' + (timeZone || '');

        // 2. Return a Record with fields [[weekday]], [[era]], [[year]], [[month]], [[day]],
        //    [[hour]], [[minute]], [[second]], and [[inDST]], each with the corresponding
        //    calculated value.
        return new $$core$$Record({
            '[[weekday]]': d[m + 'Day'](),
            '[[era]]'    : +(d[m + 'FullYear']() >= 0),
            '[[year]]'   : d[m + 'FullYear'](),
            '[[month]]'  : d[m + 'Month'](),
            '[[day]]'    : d[m + 'Date'](),
            '[[hour]]'   : d[m + 'Hours'](),
            '[[minute]]' : d[m + 'Minutes'](),
            '[[second]]' : d[m + 'Seconds'](),
            '[[inDST]]'  : false // ###TODO###
        });
    }
894622
def what(self):
        
        originalFromDt = dt.datetime.combine(self.except_date,
                                             timeFrom(self.overrides.time_from))
        changedFromDt = dt.datetime.combine(self.date, timeFrom(self.time_from))
        originalDaysDelta = dt.timedelta(days=self.overrides.num_days - 1)
        originalToDt = getAwareDatetime(self.except_date + originalDaysDelta,
                                        self.overrides.time_to, self.tz)
        changedDaysDelta = dt.timedelta(days=self.num_days - 1)
        changedToDt = getAwareDatetime(self.except_date + changedDaysDelta,
                                        self.time_to, self.tz)
        if originalFromDt < changedFromDt:
            return _("Postponed")
        elif originalFromDt > changedFromDt or originalToDt != changedToDt:
            return _("Rescheduled")
        else:
            return None
1336685
def where_entry_last(query, ref):
    
    return orm.select(
        e for e in query
        if e.local_date < ref.local_date or
        (e.local_date == ref.local_date and
         e.id <= ref.id
         )
    )
853989
function getCalendarMonth(moment, service, specialDaysService, dt) {
  var currentMonth = new service(moment, dt);
  var prevMonth = currentMonth.prevMonth();
  var nextMonth = currentMonth.nextMonth();
  var days = [];
  var daysCount = currentMonth.daysCount();
  var startDay = currentMonth.startDayOfMonth() - 1;
  var startNext = daysCount + startDay; // 31 -> 1

  var prev = prevMonth.daysCount() - startDay;
  var next = 1;
  var row = [];
  days.push(row);
  var maxCol = 7;
  var maxRow = 6;
  var cellCount = maxRow * maxCol;
  var localeDays = [];

  for (var i = 1; i <= cellCount; i++) {
    var isWeekend = false;
    var day = void 0;

    if (i <= startDay) {
      day = {
        day: ++prev,
        month: 'previous'
      };
      isWeekend = prevMonth.isWeekend(day.day);
      day.specialDay = specialDaysService(_objectSpread({}, prevMonth.fromDay(day.day).toNormalizedObject()));
      day.localeDay = prevMonth.localeDate().setDay(day.day).getDate().day;
    } else if (i > startNext) {
      day = {
        day: next++,
        month: 'next'
      };
      isWeekend = nextMonth.isWeekend(day.day);
      day.specialDay = specialDaysService(_objectSpread({}, nextMonth.fromDay(day.day).toNormalizedObject()));
      day.localeDay = nextMonth.localeDate().setDay(day.day).getDate().day;
    } else {
      day = {
        day: i - startDay,
        month: 'current'
      };
      isWeekend = currentMonth.isWeekend(day.day);
      day.specialDay = specialDaysService(_objectSpread({}, currentMonth.fromDay(day.day).toNormalizedObject()));
      day.localeDay = currentMonth.localeDate().setDay(day.day).getDate().day;
    }

    isWeekend && (day.isWeekend = isWeekend);
    row.push(day); // if(row.length === 1 || row.length === 7) {
    // }

    if (i > 0 && i % 7 == 0 && i !== cellCount) {
      row = [];
      days.push(row);
    }
  }

  return {
    // firstDayOfWeek: currentMonth.firstDayOfWeek(),
    longName: currentMonth.monthLong(),
    shortName: currentMonth.monthShort(),
    daysCount: currentMonth.daysCount(),
    startDayOfMonth: currentMonth.startDayOfMonth(),
    daysLong: currentMonth.weekdaysLong(),
    daysShort: currentMonth.weekdaysShort(),
    daysMin: currentMonth.weekdaysMin(),
    days: days,
    date: currentMonth.toObject(),
    localeDate: currentMonth.localeDate().getDate(),
    normalizedDate: currentMonth.toNormalizedObject(),
    previousMonth: {
      longName: prevMonth.monthLong(),
      shortName: prevMonth.monthShort(),
      daysCount: prevMonth.daysCount(),
      date: prevMonth.toObject(),
      normalizedDate: prevMonth.toNormalizedObject(),
      localeDate: prevMonth.localeDate().getDate()
    },
    nextMonth: {
      longName: nextMonth.monthLong(),
      shortName: nextMonth.monthShort(),
      daysCount: nextMonth.daysCount(),
      date: nextMonth.toObject(),
      normalizedDate: nextMonth.toNormalizedObject(),
      localeDate: nextMonth.localeDate().getDate()
    }
  };
}
873053
def _getFromTime(self, atDate=None):
        
        return getLocalTime(self.date_from, self.time_from, self.tz)
139317
def occurs_on?(date)
      date = TimeUtil.ensure_date(date)
      begin_time = TimeUtil.beginning_of_date(date, start_time)
      closing_time = TimeUtil.end_of_date(date, start_time)
      occurs_between?(begin_time, closing_time)
    end
935528
def postponed_from_when(self):
        
        what = self.what
        if what:
            return _("{what} from {when}").format(what=what,
                                                  when=self.cancellationpage.when)
166502
def last_session_date(self):
        """"""
        try:
            date = self.intervals[1]['ts']
        except KeyError:
            return None
        date_f = datetime.strptime(date, '%Y-%m-%dT%H:%M:%S.%fZ')
        now = time.time()
        offset = datetime.fromtimestamp(now) - datetime.utcfromtimestamp(now)
        return date_f + offset
311665
function utc_offset() {
      if (this.zone == ICAL.Timezone.localTimezone ||
          this.zone == ICAL.Timezone.utcTimezone) {
        return 0;
      } else {
        return this.zone.utcOffset(this);
      }
    }
826960
function() {
    var time = null;

    if (this.method === 'from now') {
      time = ago.fromNow(this.amount, this.unit);
    } else if (this.method === 'ago') {
      time = ago(this.amount, this.unit);
    } else {
      throw new Error('Invalid method: ' + this.method);
    }

    return new Date(time);
  }
386642
def date_in_past(self):
        
        now = datetime.datetime.now()
        return (now.date() > self.date)
627424
function(event) {
		var date,
			inst = $.datepicker._getInst(event.target);

		if (inst.input.val() !== inst.lastVal) {
			try {
				date = $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"),
					(inst.input ? inst.input.val() : null),
					$.datepicker._getFormatConfig(inst));

				if (date) { // only if valid
					$.datepicker._setDateFromField(inst);
					$.datepicker._updateAlternate(inst);
					$.datepicker._updateDatepicker(inst);
				}
			}
			catch (err) {
			}
		}
		return true;
	}
1101932
def _getEventsOnDay(self, request, day):
        """"""
        return getAllEventsByDay(request, day, day, home=self)[0]