UNPKG

@orange_digital/chakra-datepicker

Version:
41 lines (40 loc) 1.61 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DateColumnArithemetic = void 0; var constants_1 = require("../constants"); var DateColumnArithemetic = /** @class */ (function () { function DateColumnArithemetic(dates, viewingDate, selectedDate, years, months) { this.dates = dates; this.viewingDate = viewingDate; this.selectedDate = selectedDate; this.years = years; this.months = months; // } DateColumnArithemetic.prototype.selected = function (n) { var _a, _b, _c; if (this.months) { return n.getMonth() === ((_a = this.selectedDate) === null || _a === void 0 ? void 0 : _a.getMonth()); } else if (this.years) { return n.getFullYear() === ((_b = this.viewingDate) === null || _b === void 0 ? void 0 : _b.getFullYear()); } return n.getTime() === ((_c = this.selectedDate) === null || _c === void 0 ? void 0 : _c.getTime()); }; DateColumnArithemetic.prototype.outOfMonth = function (i, n) { return (((i === 0 && n.getDate() > 7) || (i === this.dates.length - 1 && n.getDate() <= 7)) && !(this.months || this.years)); }; DateColumnArithemetic.prototype.getButtonText = function (n) { if (this.months) { return constants_1.SHORT_MONTH_NAMES[n.getMonth()]; } else if (this.years) { return n.getFullYear(); } return n.getDate(); }; return DateColumnArithemetic; }()); exports.DateColumnArithemetic = DateColumnArithemetic;