<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<title>Événements Dynamiques</title>
</head>
<body>
<script type="application/ld+json" id="eventSchema1">
{
"@context": "https://schema.org",
"@type": "Event",
"name": "Cours de Sensibilisation - Lundi et Mardi",
"description": "Cours de sensibilisation pour la sécurité routière.",
"startDate": "REPLACE_WITH_DYNAMIC_DATE1",
"endDate": "REPLACE_WITH_DYNAMIC_DATE2",
"eventAttendanceMode": "https://schema.org/OfflineEventAttendanceMode",
"eventStatus": "https://schema.org/EventScheduled",
"image": "https://ae-l.ch/cours-de-sensibilisation/",
"organizer": {
"@type": "Organization",
"name": "AEL - Auto-école Lémanique",
"url": "https://ae-l.ch"
},
"performer": {
"@type": "Organization",
"name": "AEL - Auto-école Lémanique"
},
"offers": {
"@type": "Offer",
"price": "69",
"priceCurrency": "CHF",
"url": "https://ae-l.ch/reserver-cours-sensibilisation",
"availability": "https://schema.org/InStock",
"validFrom": "REPLACE_WITH_VALID_FROM_DATE1"
},
"location": {
"@type": "Place",
"name": "Auto-école Lémanique",
"address": {
"@type": "PostalAddress",
"streetAddress": "Rue de Lyon 6",
"addressLocality": "Genève",
"postalCode": "1201",
"addressCountry": "CH"
}
},
"url": "https://ae-l.ch/cours-de-sensibilisation/"
}
</script>
<script type="application/ld+json" id="eventSchema2">
{
"@context": "https://schema.org",
"@type": "Event",
"name": "Cours de Sensibilisation - Mercredi et Jeudi",
"description": "Cours de sensibilisation pour la sécurité routière.",
"startDate": "REPLACE_WITH_DYNAMIC_DATE3",
"endDate": "REPLACE_WITH_DYNAMIC_DATE4",
"eventAttendanceMode": "https://schema.org/OfflineEventAttendanceMode",
"eventStatus": "https://schema.org/EventScheduled",
"image": "https://ae-l.ch/cours-de-sensibilisation/",
"organizer": {
"@type": "Organization",
"name": "AEL - Auto-école Lémanique",
"url": "https://ae-l.ch"
},
"performer": {
"@type": "Organization",
"name": "AEL - Auto-école Lémanique"
},
"offers": {
"@type": "Offer",
"price": "69",
"priceCurrency": "CHF",
"url": "https://ae-l.ch/reserver-cours-sensibilisation",
"availability": "https://schema.org/InStock",
"validFrom": "REPLACE_WITH_VALID_FROM_DATE2"
},
"location": {
"@type": "Place",
"name": "Auto-école Lémanique",
"address": {
"@type": "PostalAddress",
"streetAddress": "Rue de Lyon 6",
"addressLocality": "Genève",
"postalCode": "1201",
"addressCountry": "CH"
}
},
"url": "https://ae-l.ch/cours-de-sensibilisation/"
}
</script>
<script>
function getNextDayOfWeek(dayOfWeek) {
const today = new Date();
const resultDate = new Date(today);
resultDate.setDate(today.getDate() + (dayOfWeek + 7 - today.getDay()) % 7);
return resultDate;
}
function formatDateTime(date, time) {
return date.toISOString().split('T')[0] + 'T' + time + ':00';
}
function updateEventDates() {
const nextMonday = getNextDayOfWeek(1);
const nextTuesday = getNextDayOfWeek(2);
const nextWednesday = getNextDayOfWeek(3);
const nextThursday = getNextDayOfWeek(4);
const mondayStartTime = '17:30';
const mondayEndTime = '21:30';
const tuesdayStartTime = '17:30';
const tuesdayEndTime = '21:30';
const wednesdayStartTime = '17:30';
const wednesdayEndTime = '21:30';
const thursdayStartTime = '17:30';
const thursdayEndTime = '21:30';
const schema1 = document.getElementById('eventSchema1').innerHTML;
const schema2 = document.getElementById('eventSchema2').innerHTML;
document.getElementById('eventSchema1').innerHTML = schema1
.replace('REPLACE_WITH_DYNAMIC_DATE1', formatDateTime(nextMonday, mondayStartTime))
.replace('REPLACE_WITH_DYNAMIC_DATE2', formatDateTime(nextTuesday, tuesdayEndTime))
.replace('REPLACE_WITH_VALID_FROM_DATE1', formatDateTime(nextMonday, mondayStartTime));
document.getElementById('eventSchema2').innerHTML = schema2
.replace('REPLACE_WITH_DYNAMIC_DATE3', formatDateTime(nextWednesday, wednesdayStartTime))
.replace('REPLACE_WITH_DYNAMIC_DATE4', formatDateTime(nextThursday, thursdayEndTime))
.replace('REPLACE_WITH_VALID_FROM_DATE2', formatDateTime(nextWednesday, wednesdayStartTime));
}
updateEventDates(); // Call the function to update the dates
</script>
</body>
</html>