function BaseStore() {
this._callbacks = {};
}n/a
function addDays(date, days) {
var result = new Date(date.getTime());
result.setDate(result.getDate() + days);
return result;
}n/a
function addMonths(date, months) {
var result = new Date(date.getTime());
var newMonth = result.getMonth() + months;
result.setMonth(newMonth);
// We want to maintain the same day-of-month, but that may not be possible if the new month doesn't have enough days.
// Loop until we back up to a day the new month has.
// (Weird modulo math is due to Javascript's treatment of negative numbers in modulo)
if (result.getMonth() !== ((newMonth % MONTHS_IN_YEAR) + MONTHS_IN_YEAR) % MONTHS_IN_YEAR) {
result = addDays(result, -result.getDate());
}
return result;
}n/a
function addWeeks(date, weeks) {
return addDays(date, weeks * DAYS_IN_WEEK);
}n/a
function addYears(date, years) {
var result = new Date(date.getTime());
result.setFullYear(date.getFullYear() + years);
// We want to maintain the same day-of-month, but that may not be possible if the new month doesn't have enough days.
// Loop until we back up to a day the new month has.
// (Weird modulo math is due to Javascript's treatment of negative numbers in modulo)
if (result.getMonth() !== ((date.getMonth() % MONTHS_IN_YEAR) + MONTHS_IN_YEAR) % MONTHS_IN_YEAR) {
result = addDays(result, -result.getDate());
}
return result;
}n/a
function compareDatePart(date1, date2) {
return getDatePartHashValue(date1) - getDatePartHashValue(date2);
}n/a
function compareDates(date1, date2) {
if (date1 == null && date2 == null) {
return true;
}
else if (date1 == null || date2 == null) {
return false;
}
else {
return (date1.getFullYear() === date2.getFullYear()
&& date1.getMonth() === date2.getMonth()
&& date1.getDate() === date2.getDate());
}
}n/a
function getDateRangeArray(date, dateRangeType, firstDayOfWeek) {
var datesArray = new Array();
var startDate = null;
var endDate = null;
switch (dateRangeType) {
case DateValues_1.DateRangeType.Day:
startDate = getDatePart(date);
endDate = addDays(startDate, 1);
break;
case DateValues_1.DateRangeType.Week:
startDate = getStartDateOfWeek(getDatePart(date), firstDayOfWeek);
endDate = addDays(startDate, DAYS_IN_WEEK);
break;
case DateValues_1.DateRangeType.Month:
startDate = new Date(date.getFullYear(), date.getMonth(), 1);
endDate = addMonths(startDate, 1);
break;
}
// Populate the dates array with the dates in range
datesArray.push(startDate);
var nextDate = addDays(startDate, 1);
while (!compareDates(nextDate, endDate)) {
datesArray.push(nextDate);
nextDate = addDays(nextDate, 1);
}
return datesArray;
}n/a
function isInDateRangeArray(date, dateRange) {
for (var _i = 0, dateRange_1 = dateRange; _i < dateRange_1.length; _i++) {
var dateInRange = dateRange_1[_i];
if (compareDates(date, dateInRange)) {
return true;
}
}
return false;
}n/a
function setMonth(date, month) {
return addMonths(date, month - date.getMonth());
}...
* @param {Date} date - The origin date
* @param {number} months - The number of months to offset. 'months' can be negative.
* @return {Date} A new Date object offset from the origin date by the given number of months
*/
function addMonths(date, months) {
var result = new Date(date.getTime());
var newMonth = result.getMonth() + months;
result.setMonth(newMonth);
// We want to maintain the same day-of-month, but that may not be possible if the new month doesn't have enough days.
// Loop until we back up to a day the new month has.
// (Weird modulo math is due to Javascript's treatment of negative numbers in modulo)
if (result.getMonth() !== ((newMonth % MONTHS_IN_YEAR) + MONTHS_IN_YEAR) % MONTHS_IN_YEAR) {
result = addDays(result, -result.getDate());
}
return result;
...function Route() {
return _super !== null && _super.apply(this, arguments) || this;
}n/a
function SelectionLayout(direction) {
this._direction = direction;
}n/a