"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.normalizeCellRawForFilter = void 0;
const tslib_1 = require("tslib");
const moment_timezone_1 = tslib_1.__importDefault(require("moment-timezone"));
const field_1 = require("../types/field");
const formatting_1 = require("./formatting");
// Shift raw to project TZ for TIMESTAMP-base time-interval DATE dims so drill
// filters target the displayed bucket. DATE-base dims and plain TIMESTAMPs are
// skipped — shifting would corrupt the calendar date / EQUALS comparison.
const normalizeCellRawForFilter = (rawValue, field, timezone) => {
    if (rawValue === null || rawValue === undefined)
        return rawValue;
    if (typeof rawValue !== 'string')
        return rawValue;
    if (!(0, field_1.isField)(field) ||
        field.type !== field_1.DimensionType.DATE ||
        !(0, formatting_1.shouldShiftItemTimezone)(field)) {
        return rawValue;
    }
    if (!timezone)
        return rawValue;
    return moment_timezone_1.default.utc(rawValue).tz(timezone).format('YYYY-MM-DD');
};
exports.normalizeCellRawForFilter = normalizeCellRawForFilter;
//# sourceMappingURL=normalizeCellRawForFilter.js.map