mas fixes al puto calendario

This commit is contained in:
Germán Correa 2021-09-01 20:17:32 -03:00
parent 8b29b153c4
commit 25bed35838
2 changed files with 34 additions and 19 deletions

View File

@ -1,24 +1,28 @@
document.addEventListener("DOMContentLoaded", function () {
var timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
/*var tzOffset = new Date().getTimezoneOffset()*60*1000*-1;
if(tzOffset !== -180*60*1000){
var initialSlotMin = new Date(1631541600000 + tzOffset)
.toTimeString()
.split(" ")[0];
console.log(initialSlotMin);
var initialSlotMax = new Date(1631579400000 + tzOffset)
.toTimeString()
.split(" ")[0];
console.log(initialSlotMax);
/*var slotMin = new Date("2021-09-13:14:00Z")
var slotMax = new Date("2021-09-13:23:30Z")
if(slotMax.getHours()<slotMin.getHours()){
slotMax.setHours(23)
slotMax.setMinutes(59)
}
*/
document.getElementById("timezone").innerHTML=`Zona Horaria: ${timeZone}`;
var calendarEl = document.getElementById("calendar");
var calendar = new FullCalendar.Calendar(calendarEl, {
console.log(slotMin.toLocaleTimeString(),slotMax.toLocaleTimeString())*/
//document.getElementById("timezone").innerHTML=`Zona Horaria: ${timeZone}`;
var timeZoneSelectorEl = document.getElementById("time-zone-selector");
if(timeZone !== "America/Montevideo"){
var optionEl = document.createElement('option');
optionEl.value = "local";
optionEl.innerText = timeZone;
timeZoneSelectorEl.appendChild(optionEl)
}
var calendarEl = document.getElementById("calendar");
var calendar = new FullCalendar.Calendar(calendarEl, {
schedulerLicenseKey: "CC-Attribution-NonCommercial-NoDerivatives",
googleCalendarApiKey: "AIzaSyCAkkSHMyz2HuxXxux2gOfUsLY9EC-gisE",
//themeSystem:'bootstrap',
eventDidMount: function (info) {
var tooltip = tippy(info.el, {
content: `<strong>${info.event.title}</strong><br/><strong>${info.event.extendedProps.speaker.nombre}</strong><br/>${info.event.extendedProps.description}`,
@ -88,7 +92,7 @@ document.addEventListener("DOMContentLoaded", function () {
minute: "2-digit",
meridiem: false,
},
//timeZone:"UTC",
timeZone:"America/Montevideo",
locale: "es",
initialView: "timeGridAll",
initialDate: "2021-09-13",
@ -97,9 +101,11 @@ document.addEventListener("DOMContentLoaded", function () {
end: "2021-09-19",
},
nowIndicator: true,
now: "2021-09-13",
now: "2021-09-12",
slotMinTime: "11:00:00",
slotMaxTime: "21:00:00",
//slotMinTime:"11:00:00",
//slotMaxTime:"21:00:00",
slotDuration: "00:15",
allDaySlot: false,
slotLabelFormat: {
@ -129,4 +135,7 @@ document.addEventListener("DOMContentLoaded", function () {
},
});
calendar.render();
timeZoneSelectorEl.addEventListener("change", function () {
calendar.setOption("timeZone", this.value);
});
});

View File

@ -12,6 +12,11 @@
<script src="/js/program.js"></script>
<div class="row">
<h1 id="programa"><strong>Calendario</strong> </h1>
<h4>Zona Horaria:</h4>
<select id='time-zone-selector'>
<option value='America/Montevideo' selected >America/Montevideo</option>
<option value='UTC'>UTC</option>
</select>
<h4 id="timezone"></h4>
<span style="background-color:#578e44;" class="label">Plenarias</span>
<span style="background-color: #3383cb;" class="label">Semiplenarias</span>
@ -20,6 +25,7 @@
<span style="background-color: darkred" class="label">Premiados</span>
<span style="background-color: gray;" class="label">Sesiones</span>
<span style="background-color: #812c64;" class="label ">Comisión de Género</span>
<div id="calendar"></div>
<div class="col-xs-12">
<!--<div class="alert alert-info">