Skip to content

Commit

Permalink
Merge pull request #8 from ClearyCoding/master
Browse files Browse the repository at this point in the history
Add Day To Week Counter, Add Custom Message After School On Fridays
  • Loading branch information
lochyj authored Feb 5, 2024
2 parents 42acdb8 + 9d6bfc2 commit feefee8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
tw.css
tw-o.css
tw-o.css
.idea
7 changes: 5 additions & 2 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,11 @@ function updateClock () {
const today = new Date();
const week = (getWeek(today) % 2) ? 1 : 0;

const weekdays = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
const day = weekdays[today.getDay()];

const weekIndicatorElem = document.getElementById('weekIndicator');
weekIndicatorElem.innerText = `Week ${week ? 'A' : 'B'}`;
weekIndicatorElem.innerText = `${day}, Week ${week ? 'A' : 'B'}`;
weekIndicatorElem.setAttribute('data-week', week ? 'A' : 'B');

let todaysPeriods = [];
Expand All @@ -137,7 +140,7 @@ function updateClock () {

// empty list indicates the day is over
if (uncompletedTodaysPeriods.length === 0) {
setClock('––', '––', 'Relax, the day is over');
setClock('––', '––', `${(today.getDay() === 5) ? 'Relax, the week is over' : 'Relax, the day is over'}`);

// check for periods later
const later = new Date();
Expand Down

0 comments on commit feefee8

Please sign in to comment.