"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.FilterDateItem = void 0;
const react_1 = __importDefault(require("react"));
const FilterDateItem = ({ item, type, removeFilterItem = () => { }, }) => {
    const dateIsNull = JSON.stringify(item) === JSON.stringify([null, null]);
    const startDay = !dateIsNull && item[0].getDate();
    const endDay = !dateIsNull && item[1].getDate();
    const startMonth = !dateIsNull && item[0].getMonth() + 1;
    const endMonth = !dateIsNull && item[1].getMonth() + 1;
    const startYear = !dateIsNull && item[0].getFullYear();
    const endYear = !dateIsNull && item[1].getFullYear();
    if (dateIsNull) {
        return null;
    }
    else
        return (react_1.default.createElement(react_1.default.Fragment, null,
            react_1.default.createElement("li", { className: type },
                react_1.default.createElement("strong", null,
                    type,
                    ":"),
                react_1.default.createElement("span", null,
                    startMonth,
                    "/",
                    startDay,
                    "/",
                    startYear,
                    " - ",
                    endMonth,
                    "/",
                    endDay,
                    "/",
                    endYear,
                    react_1.default.createElement("span", { onClick: () => removeFilterItem(item.param, item.value) }, "\u00D7")))));
};
exports.FilterDateItem = FilterDateItem;
