Creates a new Temp and initializes it with the current date if no date
 is provided
 Provides the date calculation methods dynamically
175754
def method_missing(name, *args)
      add_regex = %r{
        ^([ib])(?:n|ack)?
        (?:\.|_|-| )?
        (\d+)
        (?:\.|_|-| )?
        ([dwmy])
        (?:ays?|eeks?|onths?|ears?)?$
      }x

      weekday_regex = %r{
        ^(tod|tom|y)(?:a?y?|o?r?r?o?w?|e?s?t?e?r?d?a?y?)?$
      }xi
      
      next_weekday_regex = %r{
        ^(n|p)(?:e?x?t|r?e?v?i?o?u?s?)?
        (?:\.|_| |-)?
        (mo|tu|we|th|fr|sa|su)
        (?:n?|e?s?|d?n?e?s?|u?r?s?|i?|t?u?r?|n?)(?:d?a?y?)$ 
      }xi

      next_weekday_in_regex = %r{
        ^(mo|tu|we|th|fr|sa|su)
        (?:n?|e?s?|d?n?e?s?|u?r?s?|i?|t?u?r?|n?)(?:d?a?y?)(?:_?)
        (i|b)
        (?:n?|a?c?k?)(?:_?)
        (\d+)(?:_?)([dwmy])(?:a?y?s?|e?e?k?s?|o?n?t?h?s?|e?a?r?s?)$
      }xi

      return add($1, $2, $3)      if name =~ add_regex
      return weekday($1)          if name =~ weekday_regex
      return next_weekday($1, $2) if name =~ next_weekday_regex
      return next_weekday_in($1, $2, $3, $4) if name =~ next_weekday_in_regex
      super 
    end
769673
function(inst, date, noChange) {
		var clear = !date,
			origMonth = inst.selectedMonth,
			origYear = inst.selectedYear,
			newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date()));

		inst.selectedDay = inst.currentDay = newDate.getDate();
		inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth();
		inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear();
		if ((origMonth !== inst.selectedMonth || origYear !== inst.selectedYear) && !noChange) {
			this._notifyChange(inst);
		}
		this._adjustInstDate(inst);
		if (inst.input) {
			inst.input.val(clear ? "" : this._formatDate(inst));
		}
	}
1197924
def set_temperature(self, zone, temperature, until=None):
        """"""
        if until is None:
            data = {"Value": temperature, "Status": "Hold", "NextTime": None}
        else:
            data = {"Value": temperature,
                    "Status": "Temporary",
                    "NextTime": until.strftime('%Y-%m-%dT%H:%M:%SZ')}

        self._set_heat_setpoint(zone, data)
41975
static Generator byMonthDayGenerator(int[] dates, final DateValue dtStart) {
        final int[] udates = Util.uniquify(dates);

        return new Generator() {
            int year = dtStart.year();
            int month = dtStart.month();
            /** list of generated dates for the current month */
            int[] posDates;
            /** index of next date to return */
            int i = 0;

            {
                convertDatesToAbsolute();
            }

            private void convertDatesToAbsolute() {
                IntSet posDates = new IntSet();
                int nDays = TimeUtils.monthLength(year, month);
                for (int j = 0; j < udates.length; ++j) {
                    int date = udates[j];
                    if (date < 0) {
                        date += nDays + 1;
                    }
                    if (date >= 1 && date <= nDays) {
                        posDates.add(date);
                    }
                }
                this.posDates = posDates.toIntArray();
            }

            @Override
            boolean generate(DTBuilder builder) {
                if (year != builder.year || month != builder.month) {
                    year = builder.year;
                    month = builder.month;

                    convertDatesToAbsolute();

                    i = 0;
                }
                if (i >= posDates.length) {
                    return false;
                }
                builder.day = posDates[i++];
                return true;
            }

            @Override
            public String toString() {
                return "byMonthDayGenerator";
            }
        };
    }
456190
private function _buildDates()
    {
        if ( !$this->from || !$this->to || $this->from > $this->to ) {
            return;
        }
        $this->dates = array();
        $d = clone $this->from;
        $this->dates[] = clone $d;
        while ( $d != $this->to ) {
            $d->add(new \DateInterval('P1D'));
            $this->dates[] = clone $d;
        }
    }
441627
def create_weight(self, weight, date=None):
        
        url = self._build_url('my', 'body', 'weight')
        data = {'weightInKilograms': weight}
        if date:
            if not date.is_aware():
                raise ValueError("provided date is not timezone aware")
            data.update(date=date.isoformat())
        headers = {'Content-Type': 'application/json; charset=utf8'}
        r = self.session.post(url, data=json.dumps(data), headers=headers)
        r.raise_for_status()
        return r
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);
  }
1287103
private void setupTempLists()
    {
        //synchronized(this){   //d173022.2
        //d115597 if necessary create a new tempList
        // and list of currentBeanOs.  Always delay this until actually needed
        //d115597

        if (tempList == null) {
            tempList = new ArrayList<BeanO>();
            currentBeanOs = new HashMap<BeanId, BeanO>();//should release old list
        }
        //}
    }
265518
private void initDatesPanel() {

        m_startLabel.setText(Messages.get().key(Messages.GUI_SERIALDATE_TIME_STARTTIME_0));
        m_startTime.setAllowInvalidValue(true);
        m_startTime.setValue(m_model.getStart());
        m_endLabel.setText(Messages.get().key(Messages.GUI_SERIALDATE_TIME_ENDTIME_0));
        m_endTime.setAllowInvalidValue(true);
        m_endTime.setValue(m_model.getEnd());
        m_seriesCheckBox.setText(Messages.get().key(Messages.GUI_SERIALDATE_SERIES_CHECKBOX_0));
        m_wholeDayCheckBox.setText(Messages.get().key(Messages.GUI_SERIALDATE_WHOLE_DAY_CHECKBOX_0));
        m_currentTillEndCheckBox.setText(Messages.get().key(Messages.GUI_SERIALDATE_CURRENT_TILL_END_CHECKBOX_0));
        m_currentTillEndCheckBox.getButton().setTitle(
            Messages.get().key(Messages.GUI_SERIALDATE_CURRENT_TILL_END_CHECKBOX_HELP_0));
    }
759920
def __set_date(self, value):
        '''
        
        '''
        if not issubclass(value.__class__, date):
            raise ValueError('Invalid date value')

        self.__date = value
497778
def date(self, *args, **kwargs):
        
        compare = Date(*args, **kwargs)
        self.add(compare)

        return self
356434
def new(self):
        # type: () -> None
        '''
        
        '''
        if self._initialized:
            raise pycdlibexception.PyCdlibInternalError('UDF Timestamp already initialized')

        tm = time.time()
        local = time.localtime(tm)

        self.tz = utils.gmtoffset_from_tm(tm, local)
        # FIXME: for the timetype, 0 is UTC, 1 is local, 2 is 'agreement'.
        # We should let the user set this.
        self.timetype = 1
        self.year = local.tm_year
        self.month = local.tm_mon
        self.day = local.tm_mon
        self.hour = local.tm_hour
        self.minute = local.tm_min
        self.second = local.tm_sec
        self.centiseconds = 0
        self.hundreds_microseconds = 0
        self.microseconds = 0

        self._initialized = True
320353
def _build_date(date, kwargs):
    
    if date is None:
        if not kwargs:
            raise ValueError('Must pass a date or kwargs')
        else:
            return datetime.date(**kwargs)

    elif kwargs:
        raise ValueError('Cannot pass kwargs and a date')
    else:
        return date
255696
def add_date(self, date):
        
        self.lines = self.parser.add_date(date, self.lines)
492585
private void construct(int _raw,
                           int _startMonth,
                           int _startDay,
                           int _startDayOfWeek,
                           int _startTime,
                           int _startTimeMode,
                           int _endMonth,
                           int _endDay,
                           int _endDayOfWeek,
                           int _endTime,
                           int _endTimeMode,
                           int _dst) {
        raw            = _raw;
        startMonth     = _startMonth;
        startDay       = _startDay;
        startDayOfWeek = _startDayOfWeek;
        startTime      = _startTime;
        startTimeMode  = _startTimeMode;
        endMonth       = _endMonth;
        endDay         = _endDay;
        endDayOfWeek   = _endDayOfWeek;
        endTime        = _endTime;
        endTimeMode    = _endTimeMode;
        dst            = _dst;
        startYear      = 0;
        startMode      = DOM_MODE;
        endMode        = DOM_MODE;

        decodeRules();

        if (_dst <= 0) {
            throw new IllegalArgumentException();
        }
    }
367470
function updateDays(state, forceCreation) {
  const { dayCount, dayRole, locale, showCompleteWeeks, startDate } = state;
  const workingStartDate = showCompleteWeeks ?
    calendar.firstDateOfWeek(startDate, locale) :
    calendar.midnightOnDate(startDate);
  let workingDayCount;
  if (showCompleteWeeks) {
    const endDate = calendar.offsetDateByDays(startDate, dayCount - 1);
    const workingEndDate = calendar.lastDateOfWeek(endDate, locale);
    workingDayCount = calendar.daysBetweenDates(workingStartDate, workingEndDate) + 1;
  } else {
    workingDayCount = dayCount;
  }

  let days = state.days ? state.days.slice() : [];

  let date = workingStartDate;
  for (let i = 0; i < workingDayCount; i++) {
    const createNewElement = forceCreation || i >= days.length;
    const day = createNewElement ?
      template.createElement(dayRole) :
      days[i];
    day.date = new Date(date.getTime());
    day.locale = locale;
    day.style.gridColumnStart = '';
    if (createNewElement) {
      days[i] = day;
    }
    date = calendar.offsetDateByDays(date, 1);
  }

  if (workingDayCount < days.length) {
    // Trim days which are no longer needed.
    days = days.slice(0, workingDayCount);
  }

  const firstDay = days[0];
  if (firstDay && !showCompleteWeeks) {
    // Set the grid-column on the first day. This will cause all the subsequent
    // days to line up in the calendar grid.
    const dayOfWeek = calendar.daysSinceFirstDayOfWeek(firstDay.date, state.locale);
    firstDay.style.gridColumnStart = dayOfWeek + 1;
  }

  Object.freeze(days);
  return days;
}
980707
public XAttributeTimestamp createAttributeTimestamp(String key, Date value,
			XExtension extension) {
		return new XAttributeTimestampImpl(intern(key), value, extension);
	}