Want to stay in-the-know about concerts at TURNTABLE? Be the first to know about our exclusive events!
Sign up to receive updates regarding new show announcements, promotions, show updates, and more.
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
// Function to safely parse date strings for cross-browser compatibility
function parseDate(dateString) {
// Log the raw date string for debugging purposes
console.log('Raw Published Date String:', dateString);
// Convert AM/PM time format to 24-hour format
const formattedDateString = dateString.replace(/(\d{1,2}):(\d{2})\s?(AM|PM)/i, (match, hour, minute, period) => {
let hours = parseInt(hour);
if (period.toUpperCase() === 'PM' && hours < 12) {
hours += 12;
} else if (period.toUpperCase() === 'AM' && hours === 12) {
hours = 0;
}
return `${hours.toString().padStart(2, '0')}:${minute}`;
});
// Ensure date part is in 'YYYY-MM-DD' format
const isoDateString = formattedDateString
.replace(/(\d{1,2})\/(\d{1,2})\/(\d{4})/, (match, month, day, year) => {
return `${year}-${month.padStart(2, '0')}-${day.padStart(2, '0')}`;
})
.replace(' ', 'T') + ':00';
// Log the formatted date string for debugging
console.log('Formatted Date String:', isoDateString);
// Create the date object with correct timezone
return new Date(isoDateString);
}