var Wick = Wick || {};
Wick.FooterСurrentYear = (function () {
    // Old file elements
    const $footerCopyrights = $('.footer-checkout__copyright');
    const $footerCopyrightsYear = $('.footer-checkout__copyright .current-year');

    // New file elements
    const $footerCopyrightsBottom = $('.footer-bottom__copyright .footer-copyright');
    const $footerCopyrightsYearBottom = $('.footer-bottom__copyright .footer-copyright .current-year');

    let isOldCopyrightPresent = $footerCopyrights.length && $footerCopyrightsYear.length;
    let isNewCopyrightPresent = $footerCopyrightsBottom.length && $footerCopyrightsYearBottom.length

    const init = function () {
        const currentYear = new Date().getFullYear();
        if (isOldCopyrightPresent) {
            $footerCopyrightsYear.text(currentYear);
        } else if (isNewCopyrightPresent) {
            $footerCopyrightsYearBottom.text(currentYear);
        }
    }

    if (!isOldCopyrightPresent && !isNewCopyrightPresent) {
        return;
    }

    init();
})();
