janrg / MeeusSunMoon

JavaScript module to calculate times for sunrise, solar noon, and sunset, as well as moon phases based on "Astronomical Algorithms" by Jean Meeus
MIT License
31 stars 9 forks source link

Allow Date object arguments #4

Closed brettz9 closed 5 years ago

brettz9 commented 6 years ago

While Moment and Moment Timezone are dependencies anyways, I think it would still be convenient if the API could detect for conversion normal JavaScript Date objects (if not timestamp numbers and date strings) where Moment objects are expected.

janrg commented 5 years ago

I'm not convinced that this would be a good idea due to the inherent issues that JavaScript Date objects have with timezones. If you want to make use of the Date object's best-guess date parsing, I would suggest then generating a moment object with explicit timezone information from that and passing that to MSM.