Safari does not work when you try to do this in JavaScript:
const date = new Date('2022-01-08 17:26:59');
Instead, it requires a 'T' between the date and the time:
const date = new Date('2022-01-08T17:26:59');
Fixed this issue in the moonradar.html and positions.html demos.
We still render the date/time as normal, with the space,
but parse it by replacing the space with 'T'.
Thanks to @ebraminio for reporting this!
In the TypeScript/JavaScript code, the functions MakeObserver and MakeSpherical
are no longer needed, because the classes Observer and Spherical are now exported,
along with their constructors. I deleted those functions and reworked callers
to use the equivalent constructors instead.
Also fixed a few breakages in the html/browser examples that crept in recently.
The npm dependencies required are now
installed locally inside the generate folder.
Cleaned up the Astronomy object closure for TS
and kept it for the Browser bundle.
We will have some usage examples in the website.
Windows does not support relative links in Git by default.
This broke the first-time experience for Windows users.
From now on I will maintain copies of the astronomy.js
and astronomy.py in the demo folders, so that the demos
will work on Windows immediately after cloning the repo.
When I added support for pseudo-bodies like SSB
(Solar System Barycenter), it broke the positions.html demo.
Use an explicit list of the bodies to be calculated.
I should probably get rid of Astronomy.Bodies, because it
seems to invite bugs like this. I will think more about that.
Also, there was no way to manually edit the time.
Added a checkbox called "Automatic" that toggles whether
the time is updated automatically every second or
is entered by the user.
Persist the checkbox and edited time in the saved options.
I'm not going to use GitHub Pages after all, because it is
causing more problems than it is helping. All I really wanted
was a way to host live JavaScript browser examples.
I will find my own way of hosting just those.
The main problem is that GitHub pages uses a different flavor
of Markdown than GitHub. This makes it really difficult to get
something that works right across both. In general, it doubles
how much stuff I have to look at when I make a cosmetic change.
So I have already turned off GitHub Pages on this repo,
and this commit removes all links and references to it.
This example demonstrates how to calculate equatorial coordinates
and horizontal coordinates of solar system bodies.
Added explanatory comments to moonphase.c.
Added #defines for MIN_YEAR, MAX_YEAR in astronomy.h.
Removed unnecessary code from positions.html; no longer need
to calculate geocentric vector before calculating equatorial coordinates.