Skip to content

Commit

Permalink
Added Days Until Deadline Calculator
Browse files Browse the repository at this point in the history
  • Loading branch information
kamalesh-og committed May 21, 2024
1 parent 22c3c46 commit 0097820
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Calculators/Days-Until-Deadline-Calculator/index.html
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>
15 changes: 15 additions & 0 deletions Calculators/Days-Until-Deadline-Calculator/script.js
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.';
}
}
55 changes: 55 additions & 0 deletions Calculators/Days-Until-Deadline-Calculator/style.css
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;
}
14 changes: 14 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,20 @@ <h3>Calculates the day for the specified date.</h3>
</div>
</div>
</div>
<div class="box">
<div class="content">
<h2>Days Until Deadline Calculator</h2>
<h3>Calculate the Number of Days Remaining Until a Selected Date.</h3>
<div class="card-footer">
<a href="./Calculators/Days-Until-Deadline-Calculator/index.html" target="_blank">
<button>Try Now</button>
</a>
<a href="https://github.com/Rakesh9100/CalcDiverse/tree/main/Calculators/Day-From-The-Date-Calculator" title="Source Code" target="_blank">
<img src="./assets/images/github.png" alt="Source Code"></img>
</a>
</div>
</div>
</div>
<div class="box">
<div class="content">
<h2>Definite Integral Calculator</h2>
Expand Down

0 comments on commit 0097820

Please sign in to comment.