Skip to content

Commit 6eb8bc7

Browse files
Colby Galluppeterkos
andauthored
Schedule dates are shown in local timezone (#1148)
* Schedule dates are shown in local timezone * Added timezone message * Update index.html Co-authored-by: Peter Kos <[email protected]> Co-authored-by: Peter Kos <[email protected]>
1 parent 3851b13 commit 6eb8bc7

File tree

2 files changed

+7
-17
lines changed

2 files changed

+7
-17
lines changed

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ <h1>What is a Hackathon?</h1>
163163
</section>
164164
<section id="schedule" class="section-pad">
165165
<h1>Schedule</h1>
166-
<p>All times are in EST.</p>
166+
<p>Times are listed in your local time zone.</p>
167167
<div id="schedule-block">
168168
<div id="schedule-tapes">
169169
<div class="tape"></div>

index.js

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -153,19 +153,19 @@ function convertDate(date) {
153153
let output = '';
154154

155155
// hour
156-
if (date.getUTCHours() > 12) {
157-
output = String(date.getUTCHours() - 12);
156+
if (date.getHours() > 12) {
157+
output = String(date.getHours() - 12);
158158
} else {
159-
output = String(date.getUTCHours());
159+
output = String(date.getHours());
160160
}
161161

162162
// minute
163163
if (date.getMinutes() !== 0) {
164-
output += ':' + String(date.getUTCMinutes()).padStart(2, '0');
164+
output += ':' + String(date.getMinutes()).padStart(2, '0');
165165
}
166166

167167
// AM/PM
168-
if (date.getUTCHours() >= 12) {
168+
if (date.getHours() >= 12) {
169169
output += 'pm';
170170
} else {
171171
output += 'am';
@@ -181,29 +181,19 @@ function handleEventData(events) {
181181
let timeMarkerAdded = false;
182182

183183
// show second day page
184-
if (now > new Date(1613865600 * 1000)) { // start of Feb 21
184+
if (now > new Date("2021-02-21T00:00:00")) { // start of Feb 21
185185
showSecondDayEvents();
186186
}
187187

188188
events.forEach(event => {
189189
let startDate = new Date(event.start); // convert ISO 8601 -> Date object
190190

191-
// FIXME: Hotfix for time zone bug in HM
192-
// needs to return GMT to us, but it is translating to EST for some reason
193-
// We want HM to be the canonical time for now, so 12pm in HM
194-
startDate.setHours(startDate.getHours() - 5);
195-
196191
let finishDate = undefined;
197192

198193
let dateString = convertDate(startDate);
199194
if (event.finish) { // finish === null for instantaneous events
200195
finishDate = new Date(event.finish);
201196

202-
// FIXME: Hotfix for time zone bug in HM
203-
// needs to return GMT to us, but it is translating to EST for some reason
204-
// We want HM to be the canonical time for now, so 12pm in HM
205-
finishDate.setHours(finishDate.getHours() - 5);
206-
207197
let finishString = convertDate(finishDate);
208198
if (dateString.slice(-2) === finishString.slice(-2)) { // hide "am/pm" of first time if both are identical
209199
dateString = dateString.slice(0, -2);

0 commit comments

Comments
 (0)