scripts/components/CalendarCore.js
function getDayData(weekIndex, weekDayIndex, currentMonth) {
	const dayData = {};

	if (!currentMonth || !currentMonth.days || currentMonth.days[weekIndex] === undefined) {
		throw new TypeError("WeekIndex : " + weekIndex + ", weekDayIndex " + weekDayIndex + " selected day cannot be undefined");
	}

	const selectedDay = currentMonth.days[weekIndex][weekDayIndex];

	dayData.dayInfo = {
		weekDay: weekDayIndex,
		longName: currentMonth.daysLong[weekDayIndex],
		shortName: currentMonth.daysShort[weekDayIndex],
		specialDay: selectedDay.specialDay,
	};

	dayData.date = {
		day: selectedDay.day
	};

	dayData.localeDate = {
		day: currentMonth.days[weekIndex][weekDayIndex].localeDay,
		month: currentMonth.localeDate.month,
		year: currentMonth.localeDate.year,
	};

	switch (selectedDay.month) {
		// if selected day is in the current month.
		case 'current':
			dayData.monthInfo = {
				longName: currentMonth.longName,
				shortName: currentMonth.shortName,
			};

			dayData.date.month = currentMonth.date.month;
			dayData.date.year = currentMonth.date.year;
			break;
			// if selected day is in the next month.
		case 'next':
			dayData.monthInfo = {
				longName: currentMonth.nextMonth.longName,
				shortName: currentMonth.nextMonth.shortName,
			};

			dayData.localeDate.month = currentMonth.nextMonth.localeDate.month;
			dayData.localeDate.year = currentMonth.nextMonth.localeDate.year;
			dayData.date.month = currentMonth.nextMonth.date.month;
			dayData.date.year = currentMonth.nextMonth.date.year;
			break;
			// if selected day is in the previous month.
		case 'previous':
			dayData.monthInfo = {
				longName: currentMonth.previousMonth.longName,
				shortName: currentMonth.previousMonth.shortName,
			};

			dayData.localeDate.month = currentMonth.previousMonth.localeDate.month;
			dayData.localeDate.year = currentMonth.previousMonth.localeDate.year;
			dayData.date.month = currentMonth.previousMonth.date.month;
			dayData.date.year = currentMonth.previousMonth.date.year;
			break;

		default:
			throw new Error('Selected day has invalid data');
	}

	Object.seal(dayData);
	return dayData;
}
function getDayData(weekIndex, weekDayIndex, currentMonth) {
	const dayData = {};

	if (!currentMonth || !currentMonth.days || currentMonth.days[weekIndex] === undefined) {
		throw new TypeError("WeekIndex : " + weekIndex + ", weekDayIndex " + weekDayIndex + " selected day cannot be undefined");
	}

	const selectedDay = currentMonth.days[weekIndex][weekDayIndex];

	dayData.dayInfo = {
		weekDay: weekDayIndex,
		longName: currentMonth.daysLong[weekDayIndex],
		shortName: currentMonth.daysShort[weekDayIndex],
		specialDay: selectedDay.specialDay,
	};

	dayData.date = {
		day: selectedDay.day
	};

	dayData.localeDate = {
		day: currentMonth.days[weekIndex][weekDayIndex].localeDay,
		month: currentMonth.localeDate.month,
		year: currentMonth.localeDate.year,
	};

	switch (selectedDay.month) {
		// if selected day is in the current month.
		case 'current':
			dayData.monthInfo = {
				longName: currentMonth.longName,
				shortName: currentMonth.shortName,
			};

			dayData.date.month = currentMonth.date.month;
			dayData.date.year = currentMonth.date.year;
			break;
			// if selected day is in the next month.
		case 'next':
			dayData.monthInfo = {
				longName: currentMonth.nextMonth.longName,
				shortName: currentMonth.nextMonth.shortName,
			};

			dayData.localeDate.month = currentMonth.nextMonth.localeDate.month;
			dayData.localeDate.year = currentMonth.nextMonth.localeDate.year;
			dayData.date.month = currentMonth.nextMonth.date.month;
			dayData.date.year = currentMonth.nextMonth.date.year;
			break;
			// if selected day is in the previous month.
		case 'previous':
			dayData.monthInfo = {
				longName: currentMonth.previousMonth.longName,
				shortName: currentMonth.previousMonth.shortName,
			};

			dayData.localeDate.month = currentMonth.previousMonth.localeDate.month;
			dayData.localeDate.year = currentMonth.previousMonth.localeDate.year;
			dayData.date.month = currentMonth.previousMonth.date.month;
			dayData.date.year = currentMonth.previousMonth.date.year;
			break;

		default:
			throw new Error('Selected day has invalid data');
	}

	Object.seal(dayData);
	return dayData;
}
function getDayData ( weekIndex , weekDayIndex , currentMonth ) { const dayData = { } ; if ( ! currentMonth || ! currentMonth . days || currentMonth . days [ weekIndex ] === undefined ) { throw new TypeError ( "WeekIndex : " + weekIndex + ", weekDayIndex " + weekDayIndex + " selected day cannot be undefined" ) ; } const selectedDay = currentMonth . days [ weekIndex ] [ weekDayIndex ] ; dayData . dayInfo = { weekDay : weekDayIndex , longName : currentMonth . daysLong [ weekDayIndex ] , shortName : currentMonth . daysShort [ weekDayIndex ] , specialDay : selectedDay . specialDay , } ; dayData . date = { day : selectedDay . day } ; dayData . localeDate = { day : currentMonth . days [ weekIndex ] [ weekDayIndex ] . localeDay , month : currentMonth . localeDate . month , year : currentMonth . localeDate . year , } ; switch ( selectedDay . month ) { // if selected day is in the current month. case 'current' : dayData . monthInfo = { longName : currentMonth . longName , shortName : currentMonth . shortName , } ; dayData . date . month = currentMonth . date . month ; dayData . date . year = currentMonth . date . year ; break ; // if selected day is in the next month. case 'next' : dayData . monthInfo = { longName : currentMonth . nextMonth . longName , shortName : currentMonth . nextMonth . shortName , } ; dayData . localeDate . month = currentMonth . nextMonth . localeDate . month ; dayData . localeDate . year = currentMonth . nextMonth . localeDate . year ; dayData . date . month = currentMonth . nextMonth . date . month ; dayData . date . year = currentMonth . nextMonth . date . year ; break ; // if selected day is in the previous month. case 'previous' : dayData . monthInfo = { longName : currentMonth . previousMonth . longName , shortName : currentMonth . previousMonth . shortName , } ; dayData . localeDate . month = currentMonth . previousMonth . localeDate . month ; dayData . localeDate . year = currentMonth . previousMonth . localeDate . year ; dayData . date . month = currentMonth . previousMonth . date . month ; dayData . date . year = currentMonth . previousMonth . date . year ; break ; default : throw new Error ( 'Selected day has invalid data' ) ; } Object . seal ( dayData ) ; return dayData ; }
Select specified day
@private
Select specified day