Open bhikkhu-kosalla-china opened 2 years ago
Do you know about Buddhist Sun apk on the play and ios store? It is written in Flutter can can be built for desktop as well, but some functions will not work, like gps and tts on some platforms (like linux). I can maybe update to include calendars as well.
introduction
you can visit this page to use the most accurate buddhist era in the world
for the details of code, can visit code link on github
this article will introduce the details and difficulties of my developing this calendar, I hope it can provide some idea to other developers.
lunar mansion nakkhatta
dawn and noon time
dawn time
code is very simple but accurate first ,we give the time and space data to
date_sun_info
function, then we can get the information of the sun in that place and that time grammardate_sun_info(timestamp,latitude,longitude);
this is php code, it also realized in JavaScript on the page which can be downloaded and used.
if you are no intested in the procedure, pls ignore the following part.
basic knowledge
the dawn can categorized in 3 kinds:
normally consider as the start of day time
but on the sea mariners can see objects
it also show the end/start of Astronomical observing
for the detail can check DAWN in wikipedia
how to calculate 6°
according to pāli text, in the dawn time, there is light in 4 directions, that means the civil twilight. So at the starting point, the sun is 6° below the horizon in the morning.
That means dawn time is 6° earlier than sunrise. How long is 6° for the sun pass by? Normally we will think: the sun go 360° is 24 hours,
But we cannot ignore the height of the sun at midday. Only if the height=90°, then the time is 24 mins. That means even the tropical zone, there are only 2 ideal days in one year. For other day, all will be longer than 24 mins. That's why some monastery just minus 30 or 40 mins from the sunrise, it simple but inaccurate.
set α as the height of the sun at midday on one single day,
It seemed complicated, right?
but in php, we can find a function called
date_sun_info()
, grammar:example:
then we can get a array contains 6 kinds of twilight:
advance accurate: astronomical refraction
the deviation of light or other electromagnetic wave from a straight line as it passes through the atmosphere due to the variation in air density as a function of height.
Atmospheric refraction of the light from a star is zero in the zenith, less than 1′ (one arc-minute) at 45° apparent altitude, and still only 5.3′ at 10° altitude; it quickly increases as altitude decreases, reaching 9.9′ at 5° altitude, 18.4′ at 2° altitude, and 35.4′ at the horizon; all values are for 10 °C and 1013.25 hPa in the visible part of the spectrum.
35.4′ will cause 3~5 mins earlier.
Don't worry, even php didn't consider astronomical refraction in
civil_twilight_begin
, but thesunrise
already consider the astronomical refraction,to simplify and change the time stamp for sec into ms final code
noon time
lunar mansion(nakkhatta) and nakshatra month(māsa)
zodiac name of year
the Chinese zodiac and Buddhist era zodiac is very similar the difference is the last day of zodiac year. In Chinese lunar calendar: consider the spring festive eve is the last day and spring festive is the first day. In Buddhist era : consider the vesākha full moon day is the last, and following day is the first day.
EX