-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Labels
Description
Description
The extension uses Date.getDay() to determine the current day of the week. However, the current weekend check incorrectly handles Sundays, leading to undefined access and background script errors.
In JavaScript:
getDay()returns0for Sunday1–5for Monday–Friday6for Saturday
The existing condition:
line 113
if (currentDate.getDay() > 5) {
return;
}only excludes Saturday (6) but allows Sunday (0) to pass through.
Due to same error ,
line 68
function setNotification(){
chrome.storage.local.get(['timetable'], function(result) {
let currentDate = new Date()
if(currentDate.getDay() > 5){
return
}
let storedData = result.timetable
storedData = Convert(storedData)
let x = storedData[Day(currentDate.getDay()-1)]
let p = 1
for(let i=0; i<x.length; i++){
const ClassTime = new Date(x[i].time)
title = x[i].title
if(calculateTimeDifference(ClassTime, 0)){
p = 0
if(calculateTimeDifference(ClassTime,0) < 15*60*1000){
Notify_urgent(ClassTime, title);
returnan undefined error is thrown in the background for the line
let x = storedData[Day(currentDate.getDay()-1)] as 0 for Sunday is also included(segmentation fault).
Reactions are currently unavailable