UNPKG

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