1
0
forked from ScoDoc/ScoDoc

WIP: saisie abs depuis calendrier (reste bug décalage jour)

This commit is contained in:
Emmanuel Viennet 2023-11-17 00:22:46 +01:00
parent 1f319dfeba
commit a7935d375a
4 changed files with 10 additions and 10 deletions

View File

@ -300,7 +300,7 @@ def _load_and_convert_ics(formsemestre: FormSemestre) -> list[dict]:
.replace(tzinfo=timezone.utc)
.astimezone(tz=None)
.strftime("%H:%M"),
"jour": event.decoded("dtstart").isoformat(),
"jour": event.decoded("dtstart").date().isoformat(),
"start": event.decoded("dtstart").isoformat(),
"end": event.decoded("dtend").isoformat(),
}

View File

@ -611,7 +611,7 @@ function updateDate() {
}
let dateStr = "";
if (!verifyNonWorkDays(date.getDay(), nonWorkDays)) {
if (!isNonWorkDay(date.getDay(), nonWorkDays)) {
dateStr = formatDate(date).capitalize();
} else {
// On se rend au dernier jour travaillé disponible
@ -645,7 +645,7 @@ function getNearestWorkDay(date) {
const aDay = 86400000; // 24 * 3600 * 1000 | H * s * ms
let day = date;
let count = 0;
while (verifyNonWorkDays(day.getDay(), nonWorkDays) && count++ < 7) {
while (isNonWorkDay(day.getDay(), nonWorkDays) && count++ < 7) {
day = new Date(day - aDay);
}
return day;
@ -702,7 +702,7 @@ function formatDateModal(str, separator = " ") {
* Vérifie si la date sélectionnée n'est pas un jour non travaillé
* Renvoie Vrai si le jour est non travaillé
*/
function verifyNonWorkDays(day, nonWorkdays) {
function isNonWorkDay(day, nonWorkdays) {
let d = "";
switch (day) {
case 0:

View File

@ -43,7 +43,7 @@
d = new Date(dateString).getDay();
if (verifyNonWorkDays(d, nonWorkDays)) return;
if (isNonWorkDay(d, nonWorkDays)) return;
matin = `${dateString}T${timeMorning}`;
midi = `${dateString}T${timeNoon}`;