Skip to content

Commit c8a8e8d

Browse files
authored
Fix calendar widget timezone display (#826)
* Fix calendar widget timezone display This requires a manual compilation of fullcalendar. See inline comments in `layouts/calendars/list.html` for details. xref: fullcalendar/fullcalendar#7450 xref: fullcalendar/fullcalendar#7456 * Remove comment
1 parent 8b5d4d4 commit c8a8e8d

File tree

3 files changed

+284
-25
lines changed

3 files changed

+284
-25
lines changed

.pre-commit-config.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,13 @@ repos:
3737
hooks:
3838
- id: codespell
3939
args:
40-
["-L", "recuse,nd,coo", "-w", "--skip=static/teams/bots-graphs.html"]
40+
[
41+
"-L",
42+
"recuse,nd,coo",
43+
"-w",
44+
"--skip=static/teams/bots-graphs.html",
45+
"--skip=static/js-non-bundled/*",
46+
]
4147

4248
ci:
4349
autofix_prs: false

layouts/calendars/list.html

Lines changed: 40 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -31,36 +31,52 @@ <h5 class="subtitle">{{ .Params.Subtitle }}</h5>
3131

3232
<br>
3333
<script src="https://cdn.jsdelivr.net/npm/vega@5"></script>
34-
<script src="https://cdnjs.cloudflare.com/ajax/libs/ical.js/1.5.0/ical.min.js"></script>
35-
<script src='https://cdn.jsdelivr.net/npm/fullcalendar@6.1.15/index.global.min.js'></script>
36-
<script src="https://cdn.jsdelivr.net/npm/@fullcalendar/icalendar@6.1.15/index.global.min.js"></script>
34+
<script src="https://unpkg.com/ical.js/dist/ical.es5.min.cjs"></script>
35+
<script src='https://cdn.jsdelivr.net/npm/fullcalendar@6.1.18/index.global.min.js'></script>
36+
37+
<!-- This is a temporary workaround for https://github.com/fullcalendar/fullcalendar/issues/7456
38+
39+
PR proposed in https://github.com/fullcalendar/fullcalendar/pull/7450 was compiled and is sourced
40+
below as `icalendar.js`
41+
42+
Build procedure:
43+
44+
0. Clone git@github.com:fullcalendar/fullcalendar.git
45+
1. pnpm install
46+
2. pnpm run build
47+
3. Unzip resulting archive in ./dist
48+
4. Copy /dist/fullcalendar-6.1.19/packages/icalendar/index.global.js to static/js-non-bundled/icalendar.js -->
49+
50+
<!-- <script src="https://cdn.jsdelivr.net/npm/@fullcalendar/icalendar@6.1.19/index.global.min.js"></script> -->
51+
<script src="/js-non-bundled/icalendar.js"></script>
52+
3753
<script>
3854
document.addEventListener('DOMContentLoaded', function() {
3955
var cal_colors = vega.scheme('category10');
4056
var community_calendar = document.getElementById('community-calendar');
4157
var calendar = new FullCalendar.Calendar(community_calendar, {
42-
aspectRatio: 1,
43-
timeZone: 'local',
44-
initialView: 'dayGridMonth',
45-
headerToolbar: {
46-
left: "prev,next today",
47-
center: "title",
48-
right: "dayGridMonth,timeGridWeek,listWeek",
49-
},
50-
eventSources: [
51-
{{ range $key, $value := $.Site.Data.calendars }}
52-
{
53-
url: '{{ $key }}.ics',
54-
format: 'ics',
55-
color: cal_colors.shift(),
56-
},
57-
{{ end }}
58-
],
59-
eventClick: function(info) {
60-
info.jsEvent.preventDefault();
61-
alert('Event: ' + info.event.title + '\n' + info.event.extendedProps.description + '\n' + 'URL: ' +info.event.url);
58+
aspectRatio: 1,
59+
timeZone: 'local',
60+
initialView: 'timeGridWeek',
61+
headerToolbar: {
62+
left: "prev,next today",
63+
center: "title",
64+
right: "dayGridMonth,timeGridWeek,listWeek",
65+
},
66+
eventSources: [
67+
{{- range $key, $value:= $.Site.Data.calendars }}
68+
{
69+
url: '{{ $key }}.ics',
70+
format: 'ics',
71+
backgroundColor: cal_colors.shift(),
6272
},
63-
eventDisplay: 'block',
73+
{{- end }}
74+
],
75+
eventClick: function(info) {
76+
info.jsEvent.preventDefault();
77+
alert('Event: ' + info.event.title + '\n' + info.event.extendedProps.description + '\n' + 'URL: ' +info.event.url);
78+
},
79+
eventDisplay: 'block',
6480
});
6581
calendar.render();
6682
});

static/js-non-bundled/icalendar.js

Lines changed: 237 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)