Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added time-based greetings #752

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions JS/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,15 @@ async function fetchData() {
setTimeout(() => {
fetchData();
}, 1000);

/* time-based greetings*/
let container = document.querySelector(".container_greeting");
let timeNow = new Date().getHours();
let greeting =
timeNow >= 5 && timeNow < 12
? "Good Morning"
: timeNow >= 12 && timeNow < 18
? "Good Afternoon"
: "Good evening";
container.innerHTML = `<h1 style="font-size:25px">${greeting} Hustler</h1>`;
/* end */
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
<div class="row">
<div class="col-lg-7 col-md-12 col-sm-12 col-xs-12">
<div class="contents">

<div class="container_greeting">DEMO TEXT</div>
<h2>CodeIN Community </h2>
<p>CodeIN Community is a Community of more than 8,000+ Coding Enthusiasts,
where we organize Open Source Programs, Hackathons, and Events on various emerging technologies and domains.
Expand Down