From af281e4b19c1f842e2a4a8863cf5d6b8678a95e0 Mon Sep 17 00:00:00 2001 From: Jayden Tan Date: Wed, 28 Jan 2026 18:21:39 -0800 Subject: [PATCH 1/5] chore(locations): add modular classrooms coords --- src/utils/locations.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/utils/locations.js b/src/utils/locations.js index 893f154..6e3ec2a 100644 --- a/src/utils/locations.js +++ b/src/utils/locations.js @@ -42,8 +42,7 @@ export const locations = { 'LSB | Life Science Building': '34.411831, -119.84380', 'PSYCH | Psychology Building': '34.411911, -119.84505', 'BIOL2 | Biological Sciences II': '34.411961, -119.84265', - '387 | Modular Classrooms': '34.411976, -119.84568', - '387 | Modular Classrooms': '34.411976, -119.84568', + 'Modular Classrooms': '34.41186, -119.845662', '251 | Psychology East': '34.412003, -119.84460', 'Madulce House': '34.412017, -119.85183', 'Art Museum': '34.412048, -119.84928', @@ -242,6 +241,7 @@ export const classrooms = { 'ESB 1001': '34.415551969364024, -119.84186070348487', 'ESB 1003': '34.41564091513607, -119.84189807263962', 'ESB 2001': '34.41570860014485, -119.8419789176278', + 'GIRV 1004': '34.4138802, -119.846701', 'GIRV 1106': '34.4137648, -119.8467023', 'GIRV 1108': '34.4137648, -119.8467023', 'GIRV 1112': '34.4137499, -119.8465852', @@ -479,5 +479,7 @@ export const classrooms = { 'WEBB 1015': '34.4134578, -119.8437129', 'WEBB 1025': '34.4134655, -119.8436201', 'WEBB 1100': '34.4134849, -119.8439309', - 'WEBB 2007': '34.4134680, -119.8438833' + 'WEBB 2007': '34.4134680, -119.8438833', + '387 1011': '34.41193, -119.845659', + '387 1015': '34.41186, -119.845662', } \ No newline at end of file From 149125d8162c399a2f759bdbb41e352a7494ed8d Mon Sep 17 00:00:00 2001 From: joshL1215 <210241055+joshL1215@users.noreply.github.com> Date: Mon, 23 Feb 2026 18:34:57 -0800 Subject: [PATCH 2/5] add hardcoded holiday date map --- src/utils/holidays.js | 44 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/utils/holidays.js diff --git a/src/utils/holidays.js b/src/utils/holidays.js new file mode 100644 index 0000000..dbb8169 --- /dev/null +++ b/src/utils/holidays.js @@ -0,0 +1,44 @@ +const getHolidays = (year) => { + function nthWeekdayOfMonth(n, weekday, month) { + const firstDayOfMonth = new Date(year, month, 1); + const firstWeekday = firstDayOfMonth.getDay(); + const offset = (weekday - firstWeekday + 7) % 7; + return new Date(year, month, 1 + offset + (n - 1) * 7); + } + + const getMemorialDay = () => { + const lastDayOfMay = new Date(year, 4, 31); + const lastWeekday = lastDayOfMay.getDay(); + const offset = (lastWeekday - 1 + 7) % 7; + return new Date(year, 4, 31 - offset); + } + + const dateRange = (startMonth, startDay, endMonth, endDay, endYear = year) => { + const dates = []; + const end = new Date(endYear, endMonth, endDay); + for (let d = new Date(year, startMonth, startDay); d <= end; d.setDate(d.getDate() + 1)) { + dates.push(new Date(d)); + } + return dates; + } + + const date = (month, day) => { + return [new Date(year, month, day)]; + } + + return new Map([ + ["Veterans Day", date(10, 11)], + ["Thanksgiving", (() => { const t = nthWeekdayOfMonth(4, 4, 10); return [t, new Date(year, 10, t.getDate() + 1)]; })()], + ["Christmas", dateRange(11, 24, 11, 25)], + ["New Years", dateRange(11, 31, 0, 1, year + 1)], + ["Winter Break", dateRange(11, 13, 0, 4, year + 1)], + ["M.L.K. Jr. Day", date(0, nthWeekdayOfMonth(3, 1, 0).getDate())], + ["Presidents Day", date(1, nthWeekdayOfMonth(3, 1, 1).getDate())], + ["Cesar Chavez Day", date(2, 27)], + ["Spring Break", dateRange(2, 21, 2, 29)], + ["Memorial Day", [getMemorialDay()]], + ["Juneteenth", date(5, 19)], + ["Independence Day", dateRange(6, 3, 6, 4)], + ["Labor Day", date(8, nthWeekdayOfMonth(1, 1, 8).getDate())], + ]); +} From c25e0a9bf6aebe5c72c3d29acc81de872ffdb060 Mon Sep 17 00:00:00 2001 From: joshL1215 <210241055+joshL1215@users.noreply.github.com> Date: Mon, 23 Feb 2026 18:44:18 -0800 Subject: [PATCH 3/5] add function for checking if current date is holiday --- src/utils/holidays.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/utils/holidays.js b/src/utils/holidays.js index dbb8169..be4f78b 100644 --- a/src/utils/holidays.js +++ b/src/utils/holidays.js @@ -42,3 +42,20 @@ const getHolidays = (year) => { ["Labor Day", date(8, nthWeekdayOfMonth(1, 1, 8).getDate())], ]); } + +export default const getTodayHoliday = () => { + const today = new Date(); + const holidays = getHolidays(today.getFullYear()); + for (const [name, dates] of holidays) { + for (const d of dates) { + if ( + d.getFullYear() === today.getFullYear() && + d.getMonth() === today.getMonth() && + d.getDate() === today.getDate() + ) { + return name; + } + } + } + return null; +} From ed385c91f38b4f480a9007d6e057ba99a4e47b8e Mon Sep 17 00:00:00 2001 From: joshL1215 <210241055+joshL1215@users.noreply.github.com> Date: Mon, 23 Feb 2026 19:25:31 -0800 Subject: [PATCH 4/5] Use date to string conversion for checks --- src/utils/holidays.js | 44 ++++++++++++++++++++----------------------- 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/src/utils/holidays.js b/src/utils/holidays.js index be4f78b..d33ba04 100644 --- a/src/utils/holidays.js +++ b/src/utils/holidays.js @@ -26,35 +26,31 @@ const getHolidays = (year) => { return [new Date(year, month, day)]; } + const fmt = (d) => d.toISOString().slice(0, 10); + return new Map([ - ["Veterans Day", date(10, 11)], - ["Thanksgiving", (() => { const t = nthWeekdayOfMonth(4, 4, 10); return [t, new Date(year, 10, t.getDate() + 1)]; })()], - ["Christmas", dateRange(11, 24, 11, 25)], - ["New Years", dateRange(11, 31, 0, 1, year + 1)], - ["Winter Break", dateRange(11, 13, 0, 4, year + 1)], - ["M.L.K. Jr. Day", date(0, nthWeekdayOfMonth(3, 1, 0).getDate())], - ["Presidents Day", date(1, nthWeekdayOfMonth(3, 1, 1).getDate())], - ["Cesar Chavez Day", date(2, 27)], - ["Spring Break", dateRange(2, 21, 2, 29)], - ["Memorial Day", [getMemorialDay()]], - ["Juneteenth", date(5, 19)], - ["Independence Day", dateRange(6, 3, 6, 4)], - ["Labor Day", date(8, nthWeekdayOfMonth(1, 1, 8).getDate())], + ["Veterans Day", date(10, 11).map(fmt)], + ["Thanksgiving", (() => { const t = nthWeekdayOfMonth(4, 4, 10); return [t, new Date(year, 10, t.getDate() + 1)]; })().map(fmt)], + ["Christmas", dateRange(11, 24, 11, 25).map(fmt)], + ["New Years", dateRange(11, 31, 0, 1, year + 1).map(fmt)], + ["Winter Break", dateRange(11, 13, 0, 4, year + 1).map(fmt)], + ["M.L.K. Jr. Day", date(0, nthWeekdayOfMonth(3, 1, 0).getDate()).map(fmt)], + ["Presidents Day", date(1, nthWeekdayOfMonth(3, 1, 1).getDate()).map(fmt)], + ["Cesar Chavez Day", date(2, 27).map(fmt)], + ["Spring Break", dateRange(2, 21, 2, 29).map(fmt)], + ["Memorial Day", [getMemorialDay()].map(fmt)], + ["Juneteenth", date(5, 19).map(fmt)], + ["Independence Day", dateRange(6, 3, 6, 4).map(fmt)], + ["Labor Day", date(8, nthWeekdayOfMonth(1, 1, 8).getDate()).map(fmt)], ]); } -export default const getTodayHoliday = () => { - const today = new Date(); - const holidays = getHolidays(today.getFullYear()); +export const getTodayHoliday = () => { + const today = new Date().toISOString().slice(0, 10); + const holidays = getHolidays(new Date().getFullYear()); for (const [name, dates] of holidays) { - for (const d of dates) { - if ( - d.getFullYear() === today.getFullYear() && - d.getMonth() === today.getMonth() && - d.getDate() === today.getDate() - ) { - return name; - } + if (dates.includes(today)) { + return name; } } return null; From dfe5a902bc7c67c27fbd1cff1c769961b5f6f03e Mon Sep 17 00:00:00 2001 From: joshL1215 <210241055+joshL1215@users.noreply.github.com> Date: Mon, 23 Feb 2026 19:42:40 -0800 Subject: [PATCH 5/5] apply holiday check and display to frontpage daily course section --- src/components/DaySummary.vue | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/DaySummary.vue b/src/components/DaySummary.vue index a2d7af7..37e4e60 100644 --- a/src/components/DaySummary.vue +++ b/src/components/DaySummary.vue @@ -2,14 +2,15 @@ import { onActivated, watch } from 'vue' import { state, cache } from '../model.js' import { classrooms } from '../utils/locations.js' +import { getTodayHoliday } from '../utils/holidays.js' import { MapPinIcon, AcademicCapIcon, BookOpenIcon } from '@heroicons/vue/24/outline' import { useRouter } from 'vue-router' const router = useRouter() +const todayHoliday = getTodayHoliday() let classes = $ref(false) let tip = $ref(''), displayTime = $ref(''), target = $ref(0), targetClass = $ref(null) - //get all classes / custom events for today, and sort by time function getClasses () { @@ -87,6 +88,7 @@ function currentwTime () { function updateStatus () { const wTime = currentwTime() let t = Infinity // target + if (todayHoliday) return tip = `Day off today for ${todayHoliday}! 😌` if (!classes || !classes.length) return tip = 'Day Off! 🏖️' for (const c of classes) { // check current class c.next = false @@ -156,7 +158,7 @@ tick() {{ targetClass.location }} -
+
{{ c.course }} @@ -173,7 +175,7 @@ tick()
{{ c.time }}
-
You don't have classes today! 👻
+
You don't have classes today! 👻