Skip to content

Commit

Permalink
Added Days between two Dates: #338 (#345)
Browse files Browse the repository at this point in the history
* Added Days between two Dates: #338

* Updated

* updated README.md file
  • Loading branch information
Anshika14528 authored Jun 18, 2024
1 parent 0776dd9 commit 715ecf7
Show file tree
Hide file tree
Showing 5 changed files with 173 additions and 0 deletions.
65 changes: 65 additions & 0 deletions Vanilla-JS-Projects/Basic/Days-Between-Two-Dates/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<h1 align='center'><b>💥 Days Between Two Dates 💥</b></h1>

<!-- -------------------------------------------------------------------------------------------------------------- -->

<h3 align='center'>Tech Stack Used 🎮</h3>
<!-- enlist all the technologies used to create this project from them (Remove comment using 'ctrl+z' or 'command+z') -->

<div align='center'>

![HTML5](https://img.shields.io/badge/html5-%23E34F26.svg?style=for-the-badge&logo=html5&logoColor=white)
![CSS3](https://img.shields.io/badge/css3-%231572B6.svg?style=for-the-badge&logo=css3&logoColor=white)
<!-- ![Bootstrap](https://img.shields.io/badge/bootstrap-%238511FA.svg?style=for-the-badge&logo=bootstrap&logoColor=white) -->
![JavaScript](https://img.shields.io/badge/javascript-%23323330.svg?style=for-the-badge&logo=javascript&logoColor=%23F7DF1E)
<!-- ![jQuery](https://img.shields.io/badge/jquery-%230769AD.svg?style=for-the-badge&logo=jquery&logoColor=white) -->
<!-- ![React](https://img.shields.io/badge/react-%2320232a.svg?style=for-the-badge&logo=react&logoColor=%2361DAFB) -->
<!-- ![Redux](https://img.shields.io/badge/redux-%23593d88.svg?style=for-the-badge&logo=redux&logoColor=white) -->
<!-- ![TailwindCSS](https://img.shields.io/badge/tailwindcss-%2338B2AC.svg?style=for-the-badge&logo=tailwind-css&logoColor=white) -->
<!-- ![Web3.js](https://img.shields.io/badge/web3.js-F16822?style=for-the-badge&logo=web3.js&logoColor=white) -->
<!-- ![Express.js](https://img.shields.io/badge/express.js-%23404d59.svg?style=for-the-badge&logo=express&logoColor=%2361DAFB) -->
<!-- ![Angular.js](https://img.shields.io/badge/angular.js-%23E23237.svg?style=for-the-badge&logo=angularjs&logoColor=white) -->
<!-- ![Next JS](https://img.shields.io/badge/Next-black?style=for-the-badge&logo=next.js&logoColor=white) -->
<!-- ![NodeJS](https://img.shields.io/badge/node.js-6DA55F?style=for-the-badge&logo=node.js&logoColor=white) -->
<!-- ![Vue.js](https://img.shields.io/badge/vuejs-%2335495e.svg?style=for-the-badge&logo=vuedotjs&logoColor=%234FC08D) -->
<!-- ![MongoDB](https://img.shields.io/badge/MongoDB-%234ea94b.svg?style=for-the-badge&logo=mongodb&logoColor=white) -->
</div>


![Line](https://github.com/Avdhesh-Varshney/WebMasterLog/assets/114330097/4b78510f-a941-45f8-a9d5-80ed0705e847)

<!-- -------------------------------------------------------------------------------------------------------------- -->

## :zap: Description 📃

- This application can tell the no. of days between two dates instantly.

<!-- -------------------------------------------------------------------------------------------------------------- -->

## :zap: How to run it? 🕹️

<!-- add the steps how to run the project -->
- Fork this project and run the `index.html` file directly.

<!-- -------------------------------------------------------------------------------------------------------------- -->

## :zap: Screenshots 📸
<!-- add the screenshot of the project (Mandatory) -->

![image](https://github.com/Avdhesh-Varshney/WebMasterLog/assets/168436423/d7985d14-bff5-4258-8713-f66c712493b1)


![Line](https://github.com/Avdhesh-Varshney/WebMasterLog/assets/114330097/4b78510f-a941-45f8-a9d5-80ed0705e847)


<!-- -------------------------------------------------------------------------------------------------------------- -->

<h4 align='center'>Developed By <b><i>Anshika</i></b> </h4>
<p align='center'>
<a href='https://github.com/Anshika14528'>
<img src='https://img.shields.io/badge/github-%23121011.svg?style=for-the-badge&logo=github&logoColor=white' />
</a>
</p>

<h4 align='center'>Happy Coding 🧑‍💻</h4>

<h3 align="center">Show some &nbsp;❤️&nbsp; by &nbsp;🌟&nbsp; this repository!</h3>
32 changes: 32 additions & 0 deletions Vanilla-JS-Projects/Basic/Days-Between-Two-Dates/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Days Between Two Dates</title>
</head>

<body>
<div id="text">
<h2>Want to know Number of days</h2>
<h2>between two dates?</h2>
<h3><u>Then use my Calculator</u></h3>
</div>
<main>
<div class="container">
<label for="no">Enter Date 1: </label>
<input type="date" class="number" id="date1" placeholder="Pick date 1">
<br><br>
<label for="no">Enter Date 2: </label>
<input type="date" class="number" id="date2" placeholder="Pick date 2">
<br><br>
<button onclick="count()">Find</button>
<h2 class="text"></h2>
</div>
</main>
<script src="script.js"></script>
</body>

</html>
Binary file not shown.
17 changes: 17 additions & 0 deletions Vanilla-JS-Projects/Basic/Days-Between-Two-Dates/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const count = () => {
let date1Value = document.querySelector("#date1").value;
let date2Value = document.querySelector("#date2").value;
let txt = document.querySelector(".text");

if (date1Value === "" || date2Value === "") {
txt.textContent = "Please enter a date!";
} else {
let date1 = new Date(date1Value);
let date2 = new Date(date2Value);

let Difference_In_Time = date2.getTime() - date1.getTime();
let Difference_In_Days = Math.round(Difference_In_Time / (1000 * 3600 * 24));

txt.textContent = `${Difference_In_Days} days`;
}
};
59 changes: 59 additions & 0 deletions Vanilla-JS-Projects/Basic/Days-Between-Two-Dates/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
body {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
min-height: 100vh;
color: #fff;
background-color: #3e3e3e;
}

#text {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
border: 2px solid #0a0808;
border-radius: 10px;
padding: 1rem;
}




.container {
width: 310px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
border: 2px solid #0a0808;
border-radius: 10px;
padding: 1rem;
}

label {
margin-bottom: 20px;
color: #019b32;
font-weight: bold;
}

input {
padding: 8px;
margin-bottom: 20px;
width: 150px;
border: #bbff27
}

button {
padding: 10px;
background-color: rgb(249, 50, 86);
color: white;
border: none;
cursor: pointer;
font-size: medium;
}

button:hover {
background-color: #c518fa;
}

0 comments on commit 715ecf7

Please sign in to comment.