Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const iFirstDayOfWeek = this._getFirstDayOfWeek();
// determine weekday of first day in month
const oFirstDay = new CalendarDate(oStartDate, this._primaryCalendarType);
oFirstDay.setDate(1);
iDaysOldMonth = oFirstDay.getDay() - iFirstDayOfWeek;
if (iDaysOldMonth < 0) {
iDaysOldMonth = 7 + iDaysOldMonth;
}
if (iDaysOldMonth > 0) {
// determine first day for display
oFirstDay.setDate(1 - iDaysOldMonth);
}
const oDay = new CalendarDate(oFirstDay);
for (let i = 0; i < 42; i++) {
iYear = oDay.getYear();
oCalDate = new CalendarDate(oDay, this._primaryCalendarType);
if (bIncludeBCDates && iYear < MIN_YEAR) {
// For dates before 0001-01-01 we should render only empty squares to keep
// the month square matrix correct.
oCalDate._bBeforeFirstYear = true;
_aVisibleDays.push(oCalDate);
} else if (iYear >= MIN_YEAR && iYear <= MAX_YEAR) {
// Days before 0001-01-01 or after 9999-12-31 should not be rendered.
_aVisibleDays.push(oCalDate);
}
oDay.setDate(oDay.getDate() + 1);
}
return _aVisibleDays;
const oFirstDay = new CalendarDate(oStartDate, this._primaryCalendarType);
oFirstDay.setDate(1);
iDaysOldMonth = oFirstDay.getDay() - iFirstDayOfWeek;
if (iDaysOldMonth < 0) {
iDaysOldMonth = 7 + iDaysOldMonth;
}
if (iDaysOldMonth > 0) {
// determine first day for display
oFirstDay.setDate(1 - iDaysOldMonth);
}
const oDay = new CalendarDate(oFirstDay);
for (let i = 0; i < 42; i++) {
iYear = oDay.getYear();
oCalDate = new CalendarDate(oDay, this._primaryCalendarType);
if (bIncludeBCDates && iYear < MIN_YEAR) {
// For dates before 0001-01-01 we should render only empty squares to keep
// the month square matrix correct.
oCalDate._bBeforeFirstYear = true;
_aVisibleDays.push(oCalDate);
} else if (iYear >= MIN_YEAR && iYear <= MAX_YEAR) {
// Days before 0001-01-01 or after 9999-12-31 should not be rendered.
_aVisibleDays.push(oCalDate);
}
oDay.setDate(oDay.getDate() + 1);
}
return _aVisibleDays;
}
_getVisibleDays(oStartDate, bIncludeBCDates) {
let oCalDate,
iDaysOldMonth,
iYear;
const _aVisibleDays = [];
// If date passed generate days for new start date else return the current one
if (!oStartDate) {
return _aVisibleDays;
}
const iFirstDayOfWeek = this._getFirstDayOfWeek();
// determine weekday of first day in month
const oFirstDay = new CalendarDate(oStartDate, this._primaryCalendarType);
oFirstDay.setDate(1);
iDaysOldMonth = oFirstDay.getDay() - iFirstDayOfWeek;
if (iDaysOldMonth < 0) {
iDaysOldMonth = 7 + iDaysOldMonth;
}
if (iDaysOldMonth > 0) {
// determine first day for display
oFirstDay.setDate(1 - iDaysOldMonth);
}
const oDay = new CalendarDate(oFirstDay);
for (let i = 0; i < 42; i++) {
iYear = oDay.getYear();
oCalDate = new CalendarDate(oDay, this._primaryCalendarType);
if (bIncludeBCDates && iYear < MIN_YEAR) {