-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
08b4a2e
commit b6430cb
Showing
2 changed files
with
20 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
'use client'; | ||
|
||
export const Greeting = () => { | ||
// Get the current hour | ||
const currentHour = new Date().getHours(); | ||
|
||
// Determine the appropriate greeting based on the time of day | ||
let greeting = 'Good Morning'; | ||
if (currentHour >= 12 && currentHour < 18) { | ||
greeting = 'Good Afternoon'; | ||
} else if (currentHour >= 18 || currentHour < 5) { | ||
greeting = 'Good Evening'; | ||
} else { | ||
greeting = 'Surprise to see you here!'; | ||
} | ||
|
||
return greeting; | ||
}; |