2 Commits

Author SHA1 Message Date
55aa6af239 Correctly start weeks with Sunday
All checks were successful
Build Production Image / Build Production Image (push) Successful in 1m36s
The days of the week already reflected this, but the headers did not
match.
2024-08-23 18:40:58 -07:00
922a8d24dd Set user agent when requesting iCal
All checks were successful
Build Production Image / Build Production Image (push) Successful in 1m5s
2024-05-21 19:57:31 -07:00
2 changed files with 8 additions and 2 deletions

View File

@ -131,7 +131,7 @@ export const CalendarComponent: React.FC<{ calendar: Calendar }> = ({ calendar }
</header>
<div className="shadow ring-1 ring-black ring-opacity-5 lg:flex lg:flex-auto lg:flex-col">
<div className="grid grid-cols-7 gap-px border-b border-zinc-100 bg-gray-200 text-center text-xs font-semibold leading-6 text-gray-700 lg:flex-none">
{[['M', 'on'], ['T', 'ue'], ['W', 'ed'], ['T', 'hu'], ['F', 'ri'], ['S', 'at'], ['S', 'un']].map((d) => (
{[['S', 'un'], ['M', 'on'], ['T', 'ue'], ['W', 'ed'], ['T', 'hu'], ['F', 'ri'], ['S', 'at']].map((d) => (
<div key={d[0] + d[1]} className="bg-white py-2">
{d[0]}<span className="sr-only sm:not-sr-only">{d[1]}</span>
</div>

View File

@ -44,7 +44,13 @@ async function loadCalendar(): Promise<void> {
return;
}
const icalContents = await (await fetch(icalAddr)).text();
console.log("Refreshing iCal from Google Calendar")
// For some reason Google Calendar is sending different content based on who is requesting it.
const headers = new Headers();
headers.set('User-Agent', 'curl/7.54.1');
const icalContents = await (await fetch(icalAddr, { headers })).text();
const events = ical.parseICS(icalContents);
const thisMonth = dayjs().startOf('month');
const yesterday = dayjs().startOf('day').subtract(1, 'day');