Sunrise Noon Sunset Midnight
It shows sunrise, noon, sunset, and midnight hours of your location based on your location and date, useful for day/night modes.
Install
npm install sunrise-noon-sunset-midnight
How to Use
First, it should be imported after installing.
const sunriseNoonSunsetMidnight = ;
Then, it should be initialized.
sunriseNoonSunsetMidnight;
<latitude>
latitude of your location in degree (optional) - default = 0
<Longitude>
longitude of your location in degree (optional) - default = 0
<date>
the given date for calculation (optional) - default = now()
functions
Sunrise
sunriseNoonSunsetMidnight;
It returns a date object shows sunrise hour of given date.
Sunset
sunriseNoonSunsetMidnight;
It returns a date object shows sunset hour of given date.
Noon
sunriseNoonSunsetMidnight;
It returns a date object shows noon hour of given date.
Midnight
sunriseNoonSunsetMidnight;
It returns a date object shows midnight hour of given date.
isDay
sunriseNoonSunsetMidnight;
Returs a boolean that shows is the given date a night or day.
Sample Code
const sunriseNoonSunsetMidnight = ; sunriseNoonSunsetMidnight;const sunrise = sunriseNoonSunsetMidnight;const noon = sunriseNoonSunsetMidnight;const sunset = sunriseNoonSunsetMidnight;const midnight = sunriseNoonSunsetMidnight; console;console;console;console;console;
Equations
For finding the equations for finding how to works: