Simple web utility to track university weeks - now used by classmates

A lightweight web utility designed to help UTHM students track academic weeks throughout the semester. What started as a personal tool has grown into a widely-used resource among classmates. The application calculates the current academic week based on the university calendar, helping students stay organized and plan their coursework effectively. Its simplicity and reliability have made it an essential tool for the student community.
function calculateCurrentWeek() {
const semesterStart = new Date('2024-09-01');
const today = new Date();
// Calculate days difference
const diffTime = Math.abs(today - semesterStart);
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
// Calculate week number (accounting for breaks)
const breaks = [
{ start: new Date('2024-10-15'), end: new Date('2024-10-22') },
{ start: new Date('2024-12-20'), end: new Date('2025-01-05') }
];
let breakDays = 0;
breaks.forEach(breakPeriod => {
if (today > breakPeriod.start) {
const breakEnd = today < breakPeriod.end ? today : breakPeriod.end;
breakDays += Math.ceil((breakEnd - breakPeriod.start) / (1000 * 60 * 60 * 24));
}
});
const weekNumber = Math.ceil((diffDays - breakDays) / 7);
return weekNumber;
}Load Time
< 100ms
Bundle Size
< 10KB
Lighthouse Score
100/100
Used by 100+ students daily
Featured in student WhatsApp groups
Zero downtime since launch
