Skip to content

Commit

Permalink
Fix date widget 12:xx time
Browse files Browse the repository at this point in the history
  • Loading branch information
faisalnjs committed Dec 15, 2024
1 parent 7870fc7 commit 1581509
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion frontend/pages/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
widgets[nextWidgetId].classList.add('active');
if (widgets[nextWidgetId].querySelector('[live-time]')) {
widgets[nextWidgetId].querySelector('[live-time]').innerHTML = new Date().toLocaleTimeString('en-US', { timeZone: 'America/New_York', hour: 'numeric', minute: 'numeric' }) + ((widgets[nextWidgetId].querySelector('[live-time]').innerHTML.split(' • ')[1] && widgets[nextWidgetId].querySelector('[live-time]').innerHTML.split(' • ')[1] != '') ? ' • ' + widgets[nextWidgetId].querySelector('[live-time]').innerHTML.split(' • ')[1] : '');
}
};
};
function startSwitchInterval() {
Expand Down
6 changes: 3 additions & 3 deletions frontend/partials/header.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,11 @@
} %>
<h1><%= (isExtraHelp) ? '📖' : (isClubs) ? '📰' : (isSports) ? '🏈' : icon %></h1>
<div class="inner">
<% if ((day === 'Saturday') || (day === 'Sunday')) { %>
<% if ((weekday === 'Saturday') || (weekday === 'Sunday')) { %>
<h2>No School</h2>
<% } else { %>
<h2 live-time><%= (new Date()).toLocaleTimeString('en-US', { timeZone: 'America/New_York', hour: 'numeric', minute: 'numeric' }) %><% if (period !== -1) { %> • Period <%= period + 1 %><% } else if (isExtraHelp) { %> • Extra Help<% } else if (isClubs) { %> • Clubs<% } else if (isSports) { %> • Sports<% } %></h2>
<h5><% if (period !== -1) { %>Period <%= period + 1 %>: <%= start %> <%= startAPm %> - <%= end %> <%= endAPm %><% } else if (isExtraHelp) { %>2:43 PM - 3:15 PM<% } else if (isClubs) { %>3:15 PM - 4:00 PM<% } else if (isSports) { %>4:00 PM - 5:00 PM<% } else { %><%= dayStart %> <%= dayStartAPm %> - <%= dayEnd %> <%= dayEndAPm %><% } %></h5>
<h2 live-time><%= (new Date()).toLocaleTimeString('en-US', { timeZone: 'America/New_York', hour: 'numeric', minute: 'numeric' }).replace('00:', '12:') %><% if (period !== -1) { %> • Period <%= period + 1 %><% } else if (isExtraHelp) { %> • Extra Help<% } else if (isClubs) { %> • Clubs<% } else if (isSports) { %> • Sports<% } %></h2>
<h5><% if (period !== -1) { %>Period <%= period + 1 %>: <%= start.replace('00:', '12:') %> <%= startAPm %> - <%= end.replace('00:', '12:') %> <%= endAPm %><% } else if (isExtraHelp) { %>2:43 PM - 3:15 PM<% } else if (isClubs) { %>3:15 PM - 4:00 PM<% } else if (isSports) { %>4:00 PM - 5:00 PM<% } else { %><%= dayStart.replace('00:', '12:') %> <%= dayStartAPm %> - <%= dayEnd.replace('00:', '12:') %> <%= dayEndAPm %><% } %></h5>
<% } %>
</div>
</div>
Expand Down

0 comments on commit 1581509

Please # to comment.