mas ajustes a las vistas de calendario para el corrimiento de horas

This commit is contained in:
Germán Correa 2021-09-02 18:02:46 -03:00
parent 0842aaeaf4
commit 19becf0a05

View File

@ -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: {
@ -140,9 +146,9 @@ document.addEventListener("DOMContentLoaded", function () {
},
listView: {
type: "listWeek",
buttonText:"Lista"
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");
@ -172,22 +180,30 @@ document.addEventListener("DOMContentLoaded", function () {
calendar.changeView("timeGridAll");
break;
default:
calendar.changeView("dayGridW");
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});
else{
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")