diff --git a/public/js/program.js b/public/js/program.js index 56cff4c..0a712c2 100644 --- a/public/js/program.js +++ b/public/js/program.js @@ -114,6 +114,12 @@ document.addEventListener("DOMContentLoaded", function () { omitZeroMinute: false, meridiem: "short", }, + eventTimeFormat: { + hour: "numeric", + minute: "2-digit", + omitZeroMinute: false, + meridiem: "short", + }, eventDisplay: "block", views: { timeGridAll: { @@ -138,11 +144,11 @@ document.addEventListener("DOMContentLoaded", function () { type: "dayGridWeek", duration: { days: 2 }, }, - listView:{ - type:"listWeek", - buttonText:"Lista" + listView: { + type: "listWeek", + buttonText: "Lista", + duration: { days: 2 }, }, - }, }); calendar.render(); @@ -152,6 +158,7 @@ document.addEventListener("DOMContentLoaded", function () { calendar.setOption("timeZone", this.value); switch (this.value) { case "America/Montevideo": + calendar.setOption("locale", "es"); calendar.setOption("slotMinTime", "11:00:00"); calendar.setOption("slotMaxTime", "21:00:00"); calendar.setOption("initialDate", "2021-09-13"); @@ -162,6 +169,7 @@ document.addEventListener("DOMContentLoaded", function () { calendar.changeView("timeGridAll"); break; case "UTC": + calendar.setOption("locale", "en"); calendar.setOption("slotMinTime", "14:00:00"); calendar.setOption("slotMaxTime", "23:59:00"); calendar.setOption("initialDate", "2021-09-13"); @@ -171,23 +179,31 @@ document.addEventListener("DOMContentLoaded", function () { }); calendar.changeView("timeGridAll"); break; - default: - calendar.changeView("dayGridW"); + default: + calendar.setOption("locale",'en') let initial = moment("2021-09-13T14:00Z"); let final = moment("2021-09-17T23:30Z"); let offset = initial.utcOffset(); - calendar.setOption("slotMinTime", initial.format("H:mm")); - if(offset>0){ - calendar.setOption("slotMaxTime", {days:1,hours:offset/60}); + calendar.setOption("initialDate", initial.format("Y-MM-DD")); + + if(offset>0 && offset < 600){ + //calendar.setOption("slotMinTime", "initial.format("H:mm")"); + calendar.setOption("slotMinTime", "00:00"); + //calendar.setOption("slotMaxTime", {days:1,hours:offset/60}); + calendar.setOption("slotMaxTime", "24:00"); + calendar.changeView("listView"); + } //let currentOffset = moment().utcOffset(); //initial.add(currentOffset, "minutes"); //calendar.setOption('slotMinTime', initial.utc().format('H:mm')) - //calendar.setOption("slotMaxTime", {days:1,hours:currentOffset/60}); + //calendar.setOption("slotMaxTime", {days:1,hours:currentOffset/60}); else{ - calendar.setOption("slotMaxTime",final.format("H:mm")); + + calendar.setOption("slotMaxTime",final.format("H:mm")); + calendar.setOption("slotMinTime", initial.format("H:mm")); } - calendar.setOption("initialDate",initial.format("Y-MM-DD")); + calendar.setOption("validRange", { start: initial.format("Y-MM-DD"), end:final.add(1,'d').format("Y-MM-DD")