UNPKG

@rr0/cms

Version:

RR0 Content Management System (CMS)

21 lines (20 loc) 820 B
import { ContextFilter } from "./ContextFilter.js"; export class TimeContextFilter extends ContextFilter { constructor(context) { super(context); } filter(c) { var _a, _b, _c; const sightingTime = c.time; const time = this.context.time; if (time && sightingTime) { const day = time.getDayOfMonth(); const month = time.getMonth(); const year = time.getYear(); return (!year || year === ((_a = sightingTime.year) === null || _a === void 0 ? void 0 : _a.value)) && (!month || month === ((_b = sightingTime.month) === null || _b === void 0 ? void 0 : _b.value)) && (!day || day === ((_c = sightingTime.day) === null || _c === void 0 ? void 0 : _c.value)); } else { return true; } } }