UNPKG

1.07 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.CalendarDay = void 0;
4const index_js_1 = require("../lib/index.js");
5/**
6 * Represent the day displayed in the calendar.
7 *
8 * In DayPicker, a `Day` is a `Date` that can be displayed in the calendar. It
9 * is used as extension of the native `Date` object to provide additional
10 * information about the day.
11 */
12class CalendarDay {
13 constructor(date, displayMonth,
14 /** @ignore */
15 dateLib = index_js_1.dateLib) {
16 this.date = date;
17 this.displayMonth = displayMonth;
18 this.outside = Boolean(displayMonth && !dateLib.isSameMonth(date, displayMonth));
19 this.dateLib = dateLib;
20 }
21 /**
22 * Check if the day is the same as the given day: considering if it is in the
23 * same display month.
24 */
25 isEqualTo(day) {
26 return (this.dateLib.isSameDay(day.date, this.date) &&
27 this.dateLib.isSameMonth(day.displayMonth, this.displayMonth));
28 }
29}
30exports.CalendarDay = CalendarDay;
31//# sourceMappingURL=CalendarDay.js.map
\No newline at end of file