-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Lunar Calendars, like the Islamic calendar, begin their new days at sunset rather than midnight. To fully support these calendars, Temporal needs to implement astronomical calculations to determine sunset times, which can vary by location.
Additionally, Temporal should expose astronomical calculation functions and variables, such as sunsetTime and sunriseTime, or any other relevant APIs.
This feature was previously discussed in Temporal V1 and was suggested for inclusion in V2.
Advantages:
Supporting this behaviour in lunar calendars would give more accurate results and help in implementing accurate applications such as calendar applications or in the case of Islamic calendars having some astronomical calculations exposed by Temporal can also help in calculating Muslim Prayer times.
Concerns:
The concerns that i can foresee are:
- Increase Temporal API surface and code by including astronomical calculations
- Temporal not having access to the location or having inaccurate location will lead to incorrect or inaccurate behaviour.
Prior art:
I am not aware of any standard library implementing this behaviour however, here are some libraries that implement astronomical calculations for sunset and sunrise.
- Time4j has an implementation of
StartOfDay. - sunset is a library that calculate Sunrise and Sunset and the phase of the moon accurately based on date and geographic position (written in C++)
- EDSunriseSet Objective-C class to calculate Sunrise/Sunset/Twilight times.
- suncalc A tiny JavaScript library for calculating sun/moon positions and phases.
- Prayers-call is an example of a library that both demonstrate the use astronomical calculation and would benefit from Temporal behaving the correct way with lunar calendars as well as exposing certain astronomical calculations.
Constraints / corner cases:
- Calculating sunset and sunrise accurately requires not only latitude and longitude bus altitude as well.