Check! your birth date is palindrome or not?

Check! your birth date is palindrome or not?

First, let's know a little bite about palindrome?

A palindrome is a word or number which reads the same backward as forward.

Project overview

This is an application, that can find your birthday is palindrome or not. if your birth date is not a palindrome, It'll show you a message, your birth date is a palindrome, or if not, then the message will be how many days it got missed as well as show the nearest palindrome date.

Tech stack used for this project

  • HTML
  • CSS
  • JavaScript

GitHub

Live


Explanation

  1. Create a HTML file in which we're going to add HTML elements to build website layout div, nav, footer, form, input button, etc.

  2. Create a CSS file for styling HTML documents.

  3. Create a JavaScript file to write the logic for the Palindrome date. The Project logic is divided into the following steps to understand in a better way.

Step1: So, After creating the HTML and CSS part of this project, we'll write JavaScript logic for this project. 1.png

Step2: Select form and input element by using document.querySelector(" "). You can select form element this way also document.forms[0], and store days of month in a varibale.

2.png

Step3: Create a function that returns a reverse string.

3.png Here,

  • The Split("") method splits the string into an array.

  • reverse() The reverse method reverses the order of an array.
  • The join("") method returns an array as a string.

Step4: Create a function checks date is palindrome or not.

4.png

Step5: Create a function that converts from number to string.

5.png

Step5: Create a function that returns an array of all possible formates of a date, such that

[ddmmyyyy, mmddyyyy, yyyymmdd, ddmmyy, mmddyy, yymmdd]

6.png

Step6: Create a function that checks palindrome for all possible date formats. 7.png

Step7: Create a function that checks year is leap or not.

9.png

Step:8 Create a function that finds the next palindrome date, returns in an object.

8.png

Step:9 In the final step, addEventListener to form element with submit method.

10.png

Thank You.