@@ -59,11 +59,45 @@ function toGoogleCalendarEvents(
59
59
) : Array < gapi . client . calendar . Event > {
60
60
return activity . events . flatMap ( ( event ) =>
61
61
event . slots . map ( ( slot ) => {
62
- const startDate = term . startDateFor ( slot . startSlot ) ;
63
- const startDateEnd = term . startDateFor ( slot . endSlot ) ;
64
- const endDate = term . endDateFor ( slot . startSlot ) ;
62
+ let startDate : Date ;
63
+ let startDateEnd : Date ;
64
+ let endDate : Date ;
65
+
66
+ if (
67
+ "rawClass" in event . activity &&
68
+ event . activity . rawClass . quarterInfo ?. start
69
+ ) {
70
+ startDate = term . startDateFor (
71
+ slot . startSlot ,
72
+ undefined ,
73
+ event . activity . rawClass . quarterInfo ?. start ,
74
+ ) ;
75
+ startDateEnd = term . startDateFor (
76
+ slot . endSlot ,
77
+ undefined ,
78
+ event . activity . rawClass . quarterInfo ?. start ,
79
+ ) ;
80
+ } else {
81
+ startDate = term . startDateFor ( slot . startSlot ) ;
82
+ startDateEnd = term . startDateFor ( slot . endSlot ) ;
83
+ }
84
+
85
+ if (
86
+ "rawClass" in event . activity &&
87
+ event . activity . rawClass . quarterInfo ?. end
88
+ ) {
89
+ endDate = term . endDateFor (
90
+ slot . startSlot ,
91
+ undefined ,
92
+ event . activity . rawClass . quarterInfo ?. end ,
93
+ ) ;
94
+ } else {
95
+ endDate = term . endDateFor ( slot . startSlot ) ;
96
+ }
97
+
65
98
const exDates = term . exDatesFor ( slot . startSlot ) ;
66
99
const rDate = term . rDateFor ( slot . startSlot ) ;
100
+
67
101
return {
68
102
summary : event . name ,
69
103
location : event . room ,
@@ -83,9 +117,42 @@ function toGoogleCalendarEvents(
83
117
function toICalEvents ( activity : Activity , term : Term ) : Array < ICalEventData > {
84
118
return activity . events . flatMap ( ( event ) =>
85
119
event . slots . map ( ( slot ) => {
86
- const startDate = term . startDateFor ( slot . startSlot ) ;
87
- const startDateEnd = term . startDateFor ( slot . endSlot ) ;
88
- const endDate = term . endDateFor ( slot . startSlot ) ;
120
+ let startDate : Date ;
121
+ let startDateEnd : Date ;
122
+ let endDate : Date ;
123
+
124
+ if (
125
+ "rawClass" in event . activity &&
126
+ event . activity . rawClass . quarterInfo ?. start
127
+ ) {
128
+ startDate = term . startDateFor (
129
+ slot . startSlot ,
130
+ undefined ,
131
+ event . activity . rawClass . quarterInfo ?. start ,
132
+ ) ;
133
+ startDateEnd = term . startDateFor (
134
+ slot . endSlot ,
135
+ undefined ,
136
+ event . activity . rawClass . quarterInfo ?. start ,
137
+ ) ;
138
+ } else {
139
+ startDate = term . startDateFor ( slot . startSlot ) ;
140
+ startDateEnd = term . startDateFor ( slot . endSlot ) ;
141
+ }
142
+
143
+ if (
144
+ "rawClass" in event . activity &&
145
+ event . activity . rawClass . quarterInfo ?. end
146
+ ) {
147
+ endDate = term . endDateFor (
148
+ slot . startSlot ,
149
+ undefined ,
150
+ event . activity . rawClass . quarterInfo ?. end ,
151
+ ) ;
152
+ } else {
153
+ endDate = term . endDateFor ( slot . startSlot ) ;
154
+ }
155
+
89
156
const exDates = term . exDatesFor ( slot . startSlot ) ;
90
157
const rDate = term . rDateFor ( slot . startSlot ) ;
91
158
0 commit comments