birthday-check
made by ??
Feature:DaysToCome ✅
- YearsOld Function Return How old The Person is in a Number:
birthDay.YearsOld(user.DOB)
- DaysToBirthDay Function Return How Many Days Left to BirthDay Date in it’s String:
birthDay.DaysToBirthDay(user.DOB,'15')
Feature:DaysGone ✅
- DaysGoneBirthDay Function Return How Many Days Gone By From BirthDay Date in it’s String:
birthGone.DaysGoneBirthDay(user.DOB,'15')
This is Beta Release
?
Notes: This module package is For FrontEnd and BackEnd You Must Use Import To Work With it, You Can’t use Require With import Caution it Will Break your Code, This information is Those newbie Developers.
Install the Package by:?
npm i birthday-check
<script type="module" src="script.js"></script>
type="module"
import {DaysToCome} from './node_modules/birthday-check/dist/birthday-check.esm.js'
: and NodeJs:
How To import in to your project ReactJs:import {DaysToCome} from 'birthday-check'
CustomText if you need Different text you can add like this Example or leave Empty String Except textGreeting if you want to show Today is your BirthDay or make it Empty as you Wish ,
Initialization the class In the following Example the constructor customTexts.
const customTextDaysToCome ={
textGreeting:'Today is Your BirthDay',
textDaysLeft:'Days Left',
textDayLeft:'Day Left',
textBirthDay:'BirthDay:'
}
const customTextDaysGone ={
textDaysGone:'Days Ago',
textDayGone:'Day Ago',
textBirthDayGone:'BirthDayGone:'
}
instance class
const birthDay = new DaysToCome(customTextDaysToCome)
const birthGone = new DaysGone(customTextDaysGone)
#if you dont want customText and you happy the default Empty put string Importand Example:
const birthDay = new DaysToCome('')
const birthGone = new DaysGone('')
you need to calculate the user’s date of birth from today. It will return how many days left from now on or 1 day left or today is your birthday also Age, and how many Days Gone from birthday you can customize the Text as I already mentioned it above.
Note: This is For Browser Javascript Vanilla Tag Element and ClassName,
birthDay.DaysToBirthDay(user.DOB,'15','h1','customClass')
birthGone.DaysGoneBirthDay(user.DOB,'45','h1','customClass')
Choose your Tag Element ?:
For Reactjs <h1>
{birthDay.DaysToBirthDay(user.DOB,'15')}
</h1>
<h1>
{birthGone.DaysGoneBirthDay(user.DOB,'15')}
</h1>
This is how you can use in Reactjs to Refresh The Birthday
const [birth,setBirth] = useState('')
const [CurrentDate, setCurrentDate] = useState(new Date())
useEffect(() => {
const birthDay = new DaysToCome('')
setTimeout(() => setCurrentDate(new Date()), new Date().getDate());
setBirth(birthDay.DaysToBirthDay('2000-12-4','15'))
}, [CurrentDate]);
you can change different number this will help you to show how many days you want to remind the user it will calculate from now date to his/her days to come to their birthday date #Note: if empty or 0 only show today is your birthday, if there is a any user birthday is today.
This is for JS Vanilla Browser to use
you can use any Tag element Note ? This is good when you use for loop in javascript vanilla if you wrap your own tag you may see an empty background if there is no data so it is better to use my solution only in javascript vanilla. This solution you don’t need in ReactJs
This is for JS Vanilla Browser to use
you can add a custom class with h1 or any Tag you choose.
Feature:DaysToCome ✅
- YearsOld Function Return How old The Person:
birthDay.YearsOld(user.DOB)
- DaysToBirthDay Function Return How Many Days Left to BirthDay Date:
birthDay.DaysToBirthDay(user.DOB,'15')
Feature:DaysGone ✅
- DaysGoneBirthDay Function Return How Many Days Gone By From BirthDay Date:
birthGone.DaysGoneBirthDay(user.DOB,'15')
You can Use With Browser and ReactJs; and NodeJs:
I am working on Another Feature: JointDay