Skip to content

Commit

Permalink
fix easter logic maybe
Browse files Browse the repository at this point in the history
  • Loading branch information
C4illin committed May 3, 2024
1 parent e74fe00 commit 175c1d5
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lasvecka-node/calc_date.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ function readDatePeriod(currDate) {
) {
continue;
}

const deltaT = moment(dat).diff(currDate, "days");
if (deltaT === 0) {
return { date: dat, type: dateDict[dat] };
Expand All @@ -47,13 +48,13 @@ function readDatePeriod(currDate) {
return { date: soughtDate, type: dateDict[soughtDate] };
}

function handleEaster(easterStartDiff, easterEndDiff) {
if (easterStartDiff >= 0 && easterEndDiff <= 0) {
function handleEaster(easterStartCheck, easterEndCheck) {
if (easterStartCheck >= 0 && easterEndCheck <= 0) {
return "Självstudier";
}
if (easterEndDiff > 0) {
const weeks = Math.floor(easterEndDiff / 7);
return `Lv ${weeks + 4}`;
if (easterEndCheck > 0) {
const weeks = Math.floor(easterEndCheck / 7);
return `Lv ${weeks + 3}`;
}
}

Expand Down

0 comments on commit 175c1d5

Please sign in to comment.