def getLeapMonthOffset(a11, timeZone): Find the index of the leap month
    after the month starting on the day a11.
2822
def getLeapMonthOffset(a11, timeZone):
    ''''''
    k = int((a11 - 2415021.076998695) / 29.530588853 + 0.5)
    last = 0
    i = 1  # start with month following lunar month 11
    arc = getSunLongitude(
        getNewMoonDay(k + i, timeZone), timeZone)
    while True:
        last = arc
        i += 1
        arc = getSunLongitude(
            getNewMoonDay(k + i, timeZone),
            timeZone)
        if not (arc != last and i < 14):
            break
    return i - 1
300760
int getDaysInMonthMax(long instant) {
        int thisYear = getYear(instant);
        int thisMonth = getMonthOfYear(instant, thisYear);
        return getDaysInYearMonth(thisYear, thisMonth);
    }
296581
def get_month_from_date_str(date_str, lang=DEFAULT_DATE_LANG):
    
    date_str = date_str.lower()
    with calendar.different_locale(LOCALES[lang]):
        month_abbrs = list(calendar.month_abbr)
        for seq, abbr in enumerate(month_abbrs):
            if abbr and abbr.lower() in date_str:
                return seq, abbr
    return ()
777210
private int getCurrentlyShowingValue() {
        int currentIndex = getCurrentItemShowing();
        switch(currentIndex) {
            case HOUR_INDEX:
                return mCurrentTime.getHour();
            case MINUTE_INDEX:
                return mCurrentTime.getMinute();
            case SECOND_INDEX:
                return mCurrentTime.getSecond();
            default:
                return -1;
        }
    }
859962
def get_day_of_month(datestring):
    
    get_day = re.compile(r"\d{1,2}(st|nd|rd|th)?", re.IGNORECASE)
    day = get_day.search(datestring)
    the_day = None

    if day:
        if bool(re.search(r"[st|nd|rd|th]", day.group().lower())):
            the_day = day.group()[:-2]
        else:
            the_day = day.group()
        if int(the_day) < 10:
            the_day = add_zero(the_day)

    return str(the_day)
1143785
def _adjust_n_months(other_day, n, reference_day):
    
    if n > 0 and other_day < reference_day:
        n = n - 1
    elif n <= 0 and other_day > reference_day:
        n = n + 1
    return n
495956
function(opts, day, abbr)
    {
        day += opts.firstDay;
        while (day >= 7) {
            day -= 7;
        }
        return abbr ? opts.i18n.weekdaysShort[day] : opts.i18n.weekdays[day];
    }
635648
private static Integer[] getAdjustedMonthDays(int year) {
        Integer[] newMonths;
        try {
            newMonths = ADJUSTED_MONTH_DAYS.get(Integer.valueOf(year));
        } catch (ArrayIndexOutOfBoundsException e) {
            newMonths = null;
        }
        if (newMonths == null) {
            if (isLeapYear(year)) {
                newMonths = DEFAULT_LEAP_MONTH_DAYS;
            } else {
                newMonths = DEFAULT_MONTH_DAYS;
            }
        }
        return newMonths;
    }
315505
def _getFromDt(self):
        
        myNow = timezone.localtime(timezone=self.tz)
        return self.__after(myNow) or self.__before(myNow)
1188133
protected int handleGetMonthLength(int extendedYear, int month) {
        int thisStart = handleComputeMonthStart(extendedYear, month, true) -
            EPOCH_JULIAN_DAY + 1; // Julian day -> local days
        int nextStart = newMoonNear(thisStart + SYNODIC_GAP, true);
        return nextStart - thisStart;
    }
538707
private static boolean isLastDayOfMonth(int value, int month, boolean isLeapYear) {
		if (isLeapYear && month == 2) {
			return value == 29;
		} else {
			return value == LAST_DAYS[month - 1];
		}
	}
542210
private static String getDaysInMonthBound(int year, int month) {
	    Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
		cal.set(Calendar.YEAR, year);
	    cal.set(Calendar.MONTH, month);
		cal.set(Calendar.DAY_OF_MONTH, 1);
		return new Integer(cal.getActualMaximum(Calendar.DAY_OF_MONTH)).toString();
	}
1149917
private static int isTodayOrTomorrow(Resources r, long dayMillis,
                                         long currentMillis, long localGmtOffset) {
        int startDay = Time.getJulianDay(dayMillis, localGmtOffset);
        int currentDay = Time.getJulianDay(currentMillis, localGmtOffset);

        int days = startDay - currentDay;
        if (days == 1) {
            return TOMORROW;
        } else if (days == 0) {
            return TODAY;
        } else {
            return NONE;
        }
    }
363941
def S2L(dd, mm, yy, timeZone=7):
    ''''''
    dayNumber = jdFromDate(dd, mm, yy)
    k = int((dayNumber - 2415021.076998695) / 29.530588853)
    monthStart = getNewMoonDay(k + 1, timeZone)
    if (monthStart > dayNumber):
        monthStart = getNewMoonDay(k, timeZone)
    # alert(dayNumber + " -> " + monthStart)
    a11 = getLunarMonth11(yy, timeZone)
    b11 = a11
    if (a11 >= monthStart):
        lunarYear = yy
        a11 = getLunarMonth11(yy - 1, timeZone)
    else:
        lunarYear = yy + 1
        b11 = getLunarMonth11(yy + 1, timeZone)
    lunarDay = dayNumber - monthStart + 1
    diff = int((monthStart - a11) / 29.)

    lunarLeap = 0
    lunarMonth = diff + 11

    if (b11 - a11 > 365):
        leapMonthDiff = \
            getLeapMonthOffset(a11, timeZone)
        if (diff >= leapMonthDiff):
            lunarMonth = diff + 10
            if (diff == leapMonthDiff):
                lunarLeap = 1
    if (lunarMonth > 12):
        lunarMonth = lunarMonth - 12
    if (lunarMonth >= 11 and diff < 4):
        lunarYear -= 1
    # print [lunarDay, lunarMonth, lunarYear, lunarLeap]
    return \
        [lunarDay, lunarMonth, lunarYear, lunarLeap]
660233
def I(self):
    "'"
    if self.timezone and self.timezone.dst(self.data):
      return u'1'
    else:
      return u'0'
452543
def onOffset(self, date):
        """"""
        mod_month = (date.month - self.month) % 3
        return mod_month == 0 and date.day == self._get_offset_day(date)
353453
final int getLeapMonth(
        int cycle,
        int yearOfCycle
    ) {
        int[] leapMonths = this.getLeapMonths();
        int elapsedYears = (cycle - 1) * 60 + yearOfCycle - 1;
        int index = 2 * ((elapsedYears - leapMonths[0]) / 3); // first lower bound estimation
        int lm = 0;

        while ((index < leapMonths.length)) {
            int test = leapMonths[index];

            if (test < elapsedYears) {
                index += Math.max(2 * ((elapsedYears - test) / 3), 2);
            } else if (test > elapsedYears) {
                break;
            } else { // test == elapsedYears
                lm = leapMonths[index + 1];
                break;
            }
        }

        return lm;
    }