Gregorian calendar date for the given ISO year, week and day
182484
def _iso_to_gregorian(iso_year, iso_week, iso_day):
    ""
    year_start = _iso_year_start(iso_year)
    return year_start + dt.timedelta(days=iso_day-1, weeks=iso_week-1)
957373
def _iso_year_start(iso_year):
    ""
    fourth_jan = dt.date(iso_year, 1, 4)
    delta = dt.timedelta(fourth_jan.isoweekday()-1)
    return fourth_jan - delta
1294210
private int getDayIndex(int year, int month, int day) {
        Calendar cal = Calendar.getInstance();
        cal.set(year, month, day);
        return cal.get(Calendar.DAY_OF_WEEK);
    }
583279
function getWeekNumber(day) {
  var date = clone(day);
  date.setHours(0, 0, 0);
  date.setDate(date.getDate() + 4 - (date.getDay() || 7));
  return Math.ceil(((date - new Date(date.getFullYear(), 0, 1)) / 8.64e7 + 1) / 7);
}
587673
def infer_calendar_name(dates):
    """"""
    if np.asarray(dates).dtype == 'datetime64[ns]':
        return 'proleptic_gregorian'
    else:
        return np.asarray(dates).ravel()[0].calendar
960530
function(d) {
    if (d.wyExtent) return d.wyExtent;

    // go to start of ISO week to get to the right year
    var year = later.dw.next(later.wy.start(d), 5),
        dwFirst = later.dw.val(later.Y.start(year)),
        dwLast = later.dw.val(later.Y.end(year));

    return (d.wyExtent = [1, dwFirst === 5 || dwLast === 5 ? 53 : 52]);
  }
452767
def to_iso_date(date, default=None):
    

    # not a date
    if not is_date(date):
        return default

    # handle Zope DateTime objects
    if isinstance(date, (DateTime)):
        return date.ISO8601()

    # handle python datetime objects
    return date.isoformat()
688968
def _inc(self, incunit, incval, reqdict, origdt, dt):
        '''
        
        '''
        if incunit == TimeUnit.YEAR:
            return dt.replace(year=dt.year + incval)
        if incunit == TimeUnit.MONTH:
            newyear = dt.year
            absmonth = dt.month + incval - 1
            newmonth = absmonth % 12 + 1
            newyear += absmonth // 12
            daysinmonth = calendar.monthrange(newyear, newmonth)[1]
            dayofmonthreq = reqdict.get(TimeUnit.DAYOFMONTH)
            if dayofmonthreq is not None:
                newday = _dayofmonth(dayofmonthreq, newmonth, newyear)
            else:
                newday = min(daysinmonth, dt.day)
            return dt.replace(day=newday, month=newmonth, year=newyear)
        if incunit == TimeUnit.DAY:
            return dt + datetime.timedelta(days=incval)
        if incunit == TimeUnit.DAYOFWEEK:
            # incval in this case means next day of week whose weekday matches incval (0-6)
            days = (6 + incval - dt.weekday()) % 7 + 1
            newdt = dt + datetime.timedelta(days=days)
            assert newdt.weekday() == incval
            return newdt
        if incunit == TimeUnit.HOUR:
            return dt + datetime.timedelta(hours=incval)
        if incunit == TimeUnit.MINUTE:
            return dt + datetime.timedelta(minutes=incval)
        else:
            assert 0, 'Invalid incunit'
442471
def iso8601_date(d):
    
    if d == values.unset:
        return d
    elif isinstance(d, datetime.datetime):
        return str(d.date())
    elif isinstance(d, datetime.date):
        return str(d)
    elif isinstance(d, str):
        return d
948388
def _ssweek_to_gregorian(ssweek_year, ssweek_week, ssweek_day):
    ""
    year_start = _ssweek_year_start(ssweek_year)
    return year_start + dt.timedelta(days=ssweek_day-1, weeks=ssweek_week-1)
88042
def t(self):
    "'"
    return u'%02d' % calendar.monthrange(self.data.year, self.data.month)[1]
1357288
private static int getWeekOfYear(PlainDate date) {

        int dayOfYear = date.getDayOfYear();
        int wCurrent = getFirstCalendarWeekAsDayOfYear(date, 0);

        if (wCurrent <= dayOfYear) {
            int result = ((dayOfYear - wCurrent) / 7) + 1;

            if (result >= 53) { // Optimierung
                int wNext =
                    getFirstCalendarWeekAsDayOfYear(date, 1)
                    + getLengthOfYear(date, 0);
                if (wNext <= dayOfYear) {
                    result = 1;
                }
            }

            return result;
        } else {
            int wPrevious = getFirstCalendarWeekAsDayOfYear(date, -1);
            int dayCurrent = dayOfYear + getLengthOfYear(date, -1);
            return ((dayCurrent - wPrevious) / 7) + 1;
        }

    }
784134
def _iso_info(iso_year, iso_week):
    ""
    prev_year_start = _iso_year_start(iso_year-1)
    year_start = _iso_year_start(iso_year)
    next_year_start = _iso_year_start(iso_year+1)
    first_day = year_start + dt.timedelta(weeks=iso_week-1)
    last_day = first_day + dt.timedelta(days=6)
    prev_year_num_weeks = ((year_start - prev_year_start).days) // 7
    year_num_weeks = ((next_year_start - year_start).days) // 7
    return (first_day, last_day, prev_year_num_weeks, year_num_weeks)
460244
def day_of_year(date = self)
      date.month == 1 ? date.day : (DAYS_IN_YEAR[date.month - 2] + date.day)
    end
1272312
def date_to_epiweek(date=datetime.date.today()) -> Epiweek:
    

    year = date.year
    start_dates = list(map(_start_date_of_year, [year - 1, year, year + 1]))

    start_date = start_dates[1]
    if start_dates[1] > date:
        start_date = start_dates[0]
    elif date >= start_dates[2]:
        start_date = start_dates[2]

    return Epiweek(
        year=(start_date + datetime.timedelta(days=7)).year,
        week=((date - start_date).days // 7) + 1,
        day=(date.isoweekday() % 7) + 1
    )
309866
def date(self, year: Number, month: Number, day: Number) -> Date:
        
        return Date(year, month, day)
302211
def to_jd(year, month, day):
    ''''''
    legal_date(year, month, day)
    gyear = year + YEAR_EPOCH - 1

    return (
        gregorian.EPOCH - 1 + (365 * (gyear - 1)) +
        floor((gyear - 1) / 4) + (-floor((gyear - 1) / 100)) +
        floor((gyear - 1) / 400) + (month - 1) * 28 + day
    )