Skip to content

Commit

Permalink
TEMP PUSH
Browse files Browse the repository at this point in the history
  • Loading branch information
czozi authored Oct 25, 2024
1 parent 3a96055 commit d337e91
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 8 deletions.
3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
</head>
<body>
<div id="containereins">
<h1 id="period">Initializing...</h1>
<h1 id="time">Initializing...</h1>
<h1 id="period"></h1>
</div>
</body>
<script src="public/index.js"></script>
Expand Down
63 changes: 56 additions & 7 deletions public/index.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,82 @@
const period = document.getElementById("period"); //for later ;)

var selector = "Initializing..."

var months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
var ender = "AM";
// list of months for visual usage
var ender = "AM"; //sets default ending bit to AM

const schedule1 = [1,2,4]
const schedule2 = [3]
const schedule3 = [5]

function padZero(num) {
return num < 10 ? '0' + num : num;
}
} // pads a 0 to the beginning of any number smaller than 10

setInterval(() => {
const now = new Date();
const dow = now.getDay();
const mont = now.getMonth();
const day = now.getDate();
let hours = now.getHours();
const minutes = padZero(now.getMinutes());
const seconds = padZero(now.getSeconds());
const seconds = padZero(now.getSeconds()); // these gather all the time info for raw/display usage

const month = months[mont]; // selects the month from the array

if (hours > 12) {
hours -= 12;
ender = "PM";
hourd -= 12;
ender = "PM"; // checks if its past noon, making it pm
} else {
ender = "AM";
}

if (hours === 0) {
hours = 12;
hourd = 12; // changes 0, or midnight to say 12 for midnight.
}

document.getElementById("period").innerHTML = `Today is: ${month} ${day}, ${hours}:${minutes}:${seconds} ${ender}`; // changes the H1
if(schedule1.includes(dow)) {
if(hours < 6 && minutes < 55) {
var selector = "Before School"
};
if(hours > 6 && minutes > 55) {
var selector = "0 Hour"
};
if(hours > 7 && minutes > 50) {
var selector = "Before 1st"
};
if(hours > 7 && minutes > 55) {
var selector = "1st Hour"
};
if(hours > 8 && minutes > 50) {
var selector = "Before 2nd"
};
if(hours > 8 && minutes > 55) {
var selector = "2nd Hour"
};
if(hours > 9 && minutes > 50) {
var selector = "Before 3rd"
};
if(hours > 9 && minutes > 55) {
var selector = "3rd Hour"
};
if(hours > 10 && minutes > 55) {
var selector = "Before 4th / 1st Lunch"
};
if(hours > 11 && minutes > 25) {
var selector = "4th Hour"
};
if(hours > 11 && minutes > 55) {
var selector = "4th Hour / 2nd Lunch"
};
if(hours > 12 && minutes > ) {
var selector = "1st Hour"
};

};

document.getElementById("time").innerHTML = `Today is: ${month} ${day}, ${hours}:${minutes}:${seconds} ${ender}`; // changes the H1
document.getElementById("title").innerHTML = `${month} ${day}`; // changes title
period.innerHTML = `${selector}`
}, 250); // updates display every 1/4 of a second

0 comments on commit d337e91

Please sign in to comment.