-
Notifications
You must be signed in to change notification settings - Fork 394
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Days Until Deadline Calculator
- Loading branch information
1 parent
22c3c46
commit 0097820
Showing
4 changed files
with
104 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Days Until Deadline Calculator</title> | ||
<link rel="stylesheet" href="style.css"> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<h1>Days Until Deadline Calculator</h1> | ||
<label for="deadline">Select a date:</label> | ||
<input type="date" id="deadline"> | ||
<br><br> | ||
<button onclick="calculateDays()">Calculate Days</button> | ||
<p id="result"></p> | ||
</div> | ||
<script src="script.js"></script> | ||
</body> | ||
</html> |
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,15 @@ | ||
function calculateDays() { | ||
const deadlineInput = document.getElementById('deadline').value; | ||
if (deadlineInput) { | ||
const deadlineDate = new Date(deadlineInput); | ||
const currentDate = new Date(); | ||
|
||
const timeDifference = deadlineDate - currentDate; | ||
const daysRemaining = Math.ceil(timeDifference / (1000 * 60 * 60 * 24)); | ||
|
||
document.getElementById('result').innerText = | ||
daysRemaining >= 0 ? `${daysRemaining} days remaining` : `The date has passed.`; | ||
} else { | ||
document.getElementById('result').innerText = 'Please select a date.'; | ||
} | ||
} |
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,55 @@ | ||
body { | ||
font-family: Arial, sans-serif; | ||
background: linear-gradient(to right, #6a11cb, #2575fc); | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 100vh; | ||
margin: 0; | ||
} | ||
|
||
.container { | ||
background-color: rgba(255, 255, 255, 0.8); /* Semi-transparent white background */ | ||
padding: 20px; | ||
border-radius: 8px; | ||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); | ||
text-align: center; | ||
color: black; | ||
background-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"%3E%3Cg fill="none" stroke="%23999" stroke-width="1"%3E%3Cpath d="M0 50 L50 0 L100 50 L50 100 Z"/%3E%3Cpath d="M50 0 L50 100"/%3E%3Cpath d="M0 50 L100 50"/%3E%3C/g%3E%3C/svg%3E'); | ||
background-size: 40px 40px; | ||
background-repeat: repeat; | ||
} | ||
|
||
h1 { | ||
margin-bottom: 20px; | ||
} | ||
|
||
label { | ||
font-size: 18px; | ||
} | ||
|
||
input[type="date"] { | ||
padding: 10px; | ||
margin: 10px 0; | ||
font-size: 16px; | ||
} | ||
|
||
button { | ||
padding: 10px 20px; | ||
font-size: 16px; | ||
background-color: #007bff; | ||
color: white; | ||
border: none; | ||
border-radius: 5px; | ||
cursor: pointer; | ||
} | ||
|
||
button:hover { | ||
background-color: #0056b3; | ||
} | ||
|
||
#result { | ||
margin-top: 20px; | ||
font-size: 20px; | ||
font-weight: bold; | ||
} |
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