"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isDateLinkedToYear = exports.isRumObjectsLinkedToYear = void 0;
var isRumObjectsLinkedToYear = function (rumObjects, year) {
    // Check the year is a valid year
    if (year.toString().length !== 4) {
        return false;
    }
    var exitDates = rumObjects
        .map(function (rumObject) { return rumObject.exitDate; })
        .filter(function (exitDate) { return exitDate !== undefined; })
        .sort();
    return exitDates.length > 0 && exitDates.some(function (exitDate) { return (0, exports.isDateLinkedToYear)(exitDate, year); });
};
exports.isRumObjectsLinkedToYear = isRumObjectsLinkedToYear;
var isDateLinkedToYear = function (date, year) {
    return date.endsWith(year.toString());
};
exports.isDateLinkedToYear = isDateLinkedToYear;
