From bbd00de42fc106a61bed7df10699fdb9e4be639f Mon Sep 17 00:00:00 2001
From: Siddhi Bhanushali <69195262+siddhi-244@users.noreply.github.com>
Date: Sat, 1 Oct 2022 22:30:26 +0530
Subject: [PATCH 1/2] Create README.md
---
Age Calculator/README.md | 6 ++++++
1 file changed, 6 insertions(+)
create mode 100644 Age Calculator/README.md
diff --git a/Age Calculator/README.md b/Age Calculator/README.md
new file mode 100644
index 00000000..8b875663
--- /dev/null
+++ b/Age Calculator/README.md
@@ -0,0 +1,6 @@
+## Age Calculator
+This website is used to calculate age of a person !
+## Tech Stack
+- Html
+- CSS
+- JavaScript
From ff35f9e6934a5f90775cd2ec6d6505f5415b79ed Mon Sep 17 00:00:00 2001
From: Siddhi Bhanushali <69195262+siddhi-244@users.noreply.github.com>
Date: Sat, 1 Oct 2022 22:32:55 +0530
Subject: [PATCH 2/2] Added source code !
---
Age Calculator/index.html | 43 ++++++++++++++++
Age Calculator/script.js | 80 ++++++++++++++++++++++++++++++
Age Calculator/style.css | 102 ++++++++++++++++++++++++++++++++++++++
3 files changed, 225 insertions(+)
create mode 100644 Age Calculator/index.html
create mode 100644 Age Calculator/script.js
create mode 100644 Age Calculator/style.css
diff --git a/Age Calculator/index.html b/Age Calculator/index.html
new file mode 100644
index 00000000..05cc0a01
--- /dev/null
+++ b/Age Calculator/index.html
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Happy birthday to you !!!
+
+
+
+
+
\ No newline at end of file
diff --git a/Age Calculator/script.js b/Age Calculator/script.js
new file mode 100644
index 00000000..06c22e6c
--- /dev/null
+++ b/Age Calculator/script.js
@@ -0,0 +1,80 @@
+const months=[31,28,31,30,31,30,31,31,30,31,30,31];
+
+function ageCalc(){
+ let today=new Date();
+ let inputDate= new Date(document.getElementById("date").value);
+ let birthMonth,birthDate,birthYear;
+ let birthDetails={
+ date:inputDate.getDate(),
+ month:inputDate.getMonth()+1,
+ year:inputDate.getFullYear()
+ }
+ let currentYear=today.getFullYear();
+ let currentMonth=today.getMonth()+1;
+ let currentDay=today.getDate();
+
+
+ leapChecker(currentYear);
+
+
+ if(birthDetails.year>currentYear || (birthDetails.month > currentMonth && birthDetails.year == currentYear) ||
+ (birthDetails.date > currentDay && birthDetails.month == currentMonth && birthDetails.year == currentYear)){
+ alert("Enter Valid Date");
+
+ }
+ birthYear=currentYear-birthDetails.year;
+ if(currentMonth>=birthDetails.month){
+ birthMonth=currentMonth-birthDetails.month;
+ }
+ else{
+ birthYear--;
+ birthMonth=12+currentMonth-birthDetails.month;
+ }
+ if(currentDay>=birthDetails.date){
+ birthDate=currentDay-birthDetails.date;
+
+ }
+ else{
+ birthMonth--;
+ let days=months[currentMonth-2];
+ birthDate=days+currentDay- birthDetails.date;
+ if(birthMonth<0){
+ birthMonth=11;
+ birthYear--;
+ }
+
+ }
+
+ display(birthDate,birthMonth,birthYear);
+ checkBirthday(birthDetails.date,birthDetails.month,birthDetails.year,currentDay,currentMonth,currentYear);
+
+}
+function display(bdate,bmonth,byear){
+ document.getElementById("years").textContent=byear;
+ document.getElementById("months").textContent=bmonth;
+ document.getElementById("days").textContent=bdate;
+
+
+}
+
+function leapChecker(year){
+ if(year%4==0 || (year%100==0 && year%400==0)){
+ months[1]=29;
+ }
+ else{
+ months[1]=28;
+ }
+
+
+
+
+
+ }
+function checkBirthday(bdate,bmonth,byear,currentDay,currentMonth,currentYear){
+ if(bdate==currentDay && bmonth===currentMonth && byear