Calendario Operativo

Consulta aquí la fechas más importantes de los procesos académicos y administrativos de la Escuela, la Facultad y la Universidad.

const FROM_MONTH = 9; const FROM_YEAR = 2021; const MONTHS_TO_SHOW = 12; const TODAY = new Date();
const days = ['D', 'L', 'M', 'M', 'J', 'V', 'S']; const months = [ 'Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre', ]; const daysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; // Días de cada mes, en orden function Calendar(month, year, months) { const currentDate = new Date(); // Fecha actual, desde la que se genera el calendario en caso de no proporcionar datos de entrada this.month = isNaN(month) || month == null ? currentDate.getMonth() : month - 1; // Los meses en JS están basados en 0 this.year = isNaN(year) || year == null ? currentDate.getFullYear() : year; this.months = isNaN(months) || months == null ? 1 : months; this.html = ''; } Calendar.prototype.today = function() { const today = new Date(); const formatted = [ today.getFullYear(), ('0' + (today.getMonth() + 1)).slice(-2), ('0' + today.getDate()).slice(-2), ]; return formatted.join('-'); }; Calendar.prototype.generateHTML = function() { const today = this.today(); if (this.month == 1) { if ( (this.year % 4 == 0 && this.year % 100 != 0) || this.year % 400 == 0 ) { monthLength = 29; } } let html = ''; let curr = new Date(this.year, this.month, 1); let startingDay = curr.getDay(); let monthName = months[this.month]; let monthLength = daysInMonth[this.month]; let monthOfYear = (this.month + 1).toString().padStart(2, '0'); html += ''; html += ''; html += '<th colspan="7" class="month-year" data-year="' + this.year + '" data-month="' + monthOfYear + '">'; html += monthName + ' ' + this.year; html += ''; html += ''; for (let day = 0; day <= 6; day++) { html += ''; } html += ''; html += ''; let day = 1; for (var tr = 0; tr < 9; tr++) { // Semanas (filas) for (var td = 0; td <= 6; td++) { // Días de la semana (columnas) const classes = []; let calDate = this.year + '-' + monthOfYear + '-' + day.toString().padStart(2, '0'); let dayslot = ''; html += '<td'; if (calDate === today) { classes.push('today'); } if (td === 0) { classes.push('no-lab'); } if (day 0 || td >= startingDay)) { dayslot += ' data-date="' + calDate + '"@_CLASSES@>'; dayslot += day; day++; } else { classes.push('out'); dayslot += '@_CLASSES@>'; } dayslot += ''; html += dayslot.replace( '@_CLASSES@', classes.length > 0 ? ' class="' + classes.join(' ') + '"' : '' ); } // Si no hay más días en el mes, se detiene el ciclo... if (day > monthLength) { break; } else { html += ''; } } html += ''; this.html = html; }; Calendar.prototype.getHTML = function() { return this.html; }; jQuery(function() { let month = FROM_MONTH; let year = FROM_YEAR; let cal = 0; while (cal < MONTHS_TO_SHOW) { let calendar = new Calendar(month, year); calendar.generateHTML(); if (year < TODAY.getFullYear()) { jQuery('#cal-op-prev').append(calendar.getHTML()); } else { if (month < (TODAY.getMonth() + 1)) { jQuery('#cal-op-prev').append(calendar.getHTML()); } else { jQuery('#cal-op').append(calendar.getHTML()); } } year = month > 11 ? year + 1 : year; month = (month % 12) + 1; cal++; } });
jQuery(function() { const $cal = jQuery('table.em-calendar'); const $events = jQuery('.event-list .event'); const defaultImg = 'https://derecho.ucab.edu.ve/informatica/wp-content/uploads/sites/4/2022/01/calendario-operativo.jpg'; const events = {}; const diffDates = function(startDate, endDate) { return (new Date(endDate) - new Date(startDate)) / (1000 * 60 * 60 * 24); } // 1) Extraer los eventos de la lista, pero expandiéndolos (si duran más de un día) $events.each(function(event) { const $event = jQuery(this); const $title = $event.find('.title'); const $dateTimeInfo = $event.find('time'); const start = $dateTimeInfo.data('start'); const end = $dateTimeInfo.data('end'); const startDate = new Date(start); const endDate = new Date(end); const img = $event.data('image'); const summary = $event.find('.summary').html(); for (let i = 0; i < diffDates(startDate, endDate) + 1; i++) { const nextDate = new Date(startDate.getTime() + (i + 1) * 24 * 60 * 60 * 1000); const day = nextDate.getDate(); const month = nextDate.getMonth() + 1; const year = nextDate.getFullYear(); const nextDateStr = [year, month.toString().padStart(2, '0'), day.toString().padStart(2, '0')].join('-'); if (!events[nextDateStr]) { events[nextDateStr] = []; } events[nextDateStr].push({ title: $title.text(), start, end, dates: $event.find('.desc').text(), img, summary: summary ? summary.trim() : '', categories: $event.data('categories').split(', '), tags: $event.attr('class').split(' '), iCal: $title.data('ical'), gCal: $title.data('gcal'), }); $cal.find('td[data-date="' + nextDateStr + '"]').addClass('eventful'); } }); // 2) Generar la "tarjeta" con los eventos del día... Object.keys(events).forEach(function(date) { let dateCmp = date.split('-'); let details = '
'; let img = ''; const extraClasses = new Set(); details += '
' + [dateCmp[2], 'de', months[dateCmp[1] - 1], 'de', dateCmp[0]].join(' ') + '
'; details += '
    '; events[date].forEach(function(event) { let eventItem = '
  • '; let eventTags = event.tags.filter(function(tag) { return tag !== 'event' && tag !== 'habil'; }); img = event.img && event.img !== null && event.img !== '' ? event.img : ''; eventItem += '
    ' + event.title + '
    '; eventItem += '
    ' + event.dates.replace('-', 'al') + '
    '; if (event.summary && event.summary !== '') { eventItem += '
    ' + event.summary + '
    '; } eventItem += '
    '; eventTags.forEach(function(tag) { extraClasses.add(tag); eventItem += '' + tag.replace(/-/g, ' ') + ''; }); eventItem += '
    '; eventItem += '
      '; eventItem += 'Agrega este evento a tu calendario'; eventItem += '
    '; details += eventItem + '
  • '; }); details += '
'; details = '
' + details + '
'; // Se "inyectan" los detalles dentro de la celda correspondiente: $cal.find('td[data-date="' + date + '"]').addClass(Array.from(extraClasses)).OffCanvasPanel({ content: details, }); }); // Mostrar el calendario: $cal.removeClass('hidden'); });
jQuery(function() { const mon = ['ene', 'feb', 'mar', 'abr', 'may', 'jun', 'jul', 'ago', 'sep', 'oct', 'nov', 'dic']; const $calOpContainer = jQuery('#cal-op-container').hide(); jQuery('.event-list .et_pb_text_inner > p').remove(); const $events = jQuery('.event-list .event').filter(function() { let $event = jQuery(this); let month = parseInt($event.data('month')); let year = parseInt($event.data('year')); let result = year < TODAY.getFullYear(); if (!result) { result = month < TODAY.getMonth() + 1; } return result; }).hide(); const $title = jQuery('.event-list h2').filter(function() { let title = jQuery(this).text().split(' '); let month = mon[title[0].toLowerCase()]; let year = parseInt(title[1]); let result = year < TODAY.getFullYear(); if (!result) { result = month < TODAY.getMonth(); } return result; }).hide(); jQuery('.et_pb_tabs_controls li').on('click', function(evt) { $el = jQuery(evt.currentTarget); jQuery('.event-list h2, .event-list .event').fadeToggle(); }); $calOpContainer.fadeIn(250); });