
What went down at Jim Beam’s NYC bash
The mid-week event marked the start of the brand’s Refresh Your Season campaign
In Partnership with Jim Beam




Please enter a valid date of birth.
`;
document.body.appendChild(gate);
}
function isValidDateParts(mm, dd, yyyy) {
if (!Number.isFinite(mm) || !Number.isFinite(dd) || !Number.isFinite(yyyy)) return false;
const thisYear = new Date().getFullYear();
if (yyyy thisYear) return false;
if (mm 12) return false;
if (dd 31) return false;
// validate by round-trip to catch invalid dates like 02/31
const d = new Date(yyyy, mm – 1, dd);
return d.getFullYear() === yyyy && d.getMonth() === (mm – 1) && d.getDate() === dd;
}
function isAtLeastAge(birthDate, minAge) {
const today = new Date();
let age = today.getFullYear() – birthDate.getFullYear();
const hasHadBirthdayThisYear =
(today.getMonth() > birthDate.getMonth()) ||
(today.getMonth() === birthDate.getMonth() && today.getDate() >= birthDate.getDate());
if (!hasHadBirthdayThisYear) age -= 1;
return age >= minAge;
}
function bindEvents() {
const gate = document.getElementById(“age-gate”);
const form = document.getElementById(“age-form”);
const mmEl = document.getElementById(“dob-mm”);
const ddEl = document.getElementById(“dob-dd”);
const yyyyEl = document.getElementById(“dob-yyyy”);
const errorEl = document.getElementById(“age-error”);
const exitBtn = document.getElementById(“age-exit”);
function showError() {
errorEl.style.display = “block”;
}
function clearError() {
errorEl.style.display = “none”;
}
// digits only, keep within max length
[mmEl, ddEl, yyyyEl].forEach((el) => {
el.addEventListener(“input”, () => {
el.value = el.value.replace(/[^0-9]/g, “”).slice(0, el.maxLength || 99);
});
});
// auto-advance
mmEl.addEventListener(“input”, () => { if (mmEl.value.length >= 2) ddEl.focus(); });
ddEl.addEventListener(“input”, () => { if (ddEl.value.length >= 2) yyyyEl.focus(); });
exitBtn.addEventListener(“click”, redirectOut);
form.addEventListener(“submit”, (e) => {
e.preventDefault();
clearError();
const mm = parseInt(mmEl.value, 10);
const dd = parseInt(ddEl.value, 10);
const yyyy = parseInt(yyyyEl.value, 10);
if (!isValidDateParts(mm, dd, yyyy)) {
showError();
return;
}
const dob = new Date(yyyy, mm – 1, dd);
if (dob > new Date()) {
showError();
return;
}
if (!isAtLeastAge(dob, MIN_AGE)) {
redirectOut();
return;
}
gate.style.display = “none”;
// Optional: store only a boolean so you do not store DOB
// sessionStorage.setItem(“age_verified_21”, “true”);
});
}
function run() {
if (!enforceTimezoneFirst()) return;
// Optional: skip gate if already verified in this session
// if (sessionStorage.getItem(“age_verified_21”) === “true”) return;
injectStyles();
injectMarkup();
bindEvents();
}
// ensure body exists
if (document.readyState === “loading”) {
document.addEventListener(“DOMContentLoaded”, run);
} else {
run();
}
})();
Expand your creative community and connect with 15,000 creatives from around the world.




Please enter a valid date of birth.
Source URL: https://www.dazeddigital.com/life-culture/article/69472/1/what-went-down-at-jim-beam-nyc-bash-new-york












