Skip to content
Snippets Groups Projects
Verified Commit 25fc5225 authored by Jakob Moser's avatar Jakob Moser
Browse files

Add link to mensa menu

parent 6b1bf713
No related branches found
No related tags found
1 merge request!16Add link to the daily Mensa menu to one of the pages
......@@ -2,6 +2,22 @@ import { Service } from "../../model/Service.mjs"
import { ServiceLink } from "../pieces/ServiceLink.mjs"
import { Base } from "./Base.mjs"
const germanDateFormatter = new Intl.DateTimeFormat("de-DE", {
month: "2-digit",
day: "2-digit",
year: "numeric",
})
function getMensaLink() {
const dayToShow = new Date()
if (dayToShow.getHours() >= 15) {
// If it is 15:00 or later, show tomorrow's menu
dayToShow.setDate(dayToShow.getDate() + 1)
}
return `https://www.stw.uni-heidelberg.de/external-tools/speiseplan/speiseplan.php?lang=de&mode=Mensa+Im+Neuenheimer+Feld+304&date=${germanDateFormatter.format(dayToShow)}`
}
export const UniServices = {
oncreate() {
document.title = "Uni-Dienste · FS Coli Portal"
......@@ -46,6 +62,14 @@ export const UniServices = {
"Uni-ID",
),
),
m(
ServiceLink,
new Service(
"Mensa INF",
getMensaLink(),
"fa-solid fa-utensils",
),
),
]),
)
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment