Public
Readme
eclipsetoday - Determine if a solar or lunar eclipse is happening right now
The script checks if there's a solar or lunar eclipse
currently occurring anywhere on Earth. The script
utilizes a hardcoded list of known eclipses for the
years 2024-2026.
It will return a JSON response indicating whether an eclipse is happening
at the time of the request, along with details about the eclipse if applicable.
The script is designed to be run in a server environment, responding to
incoming HTTP requests. Upon receiving a request, it will return JSON data
in the following format:
```
{
"isEclipseHappening": true/false,
"eclipseDetails": {
"date": "2024-04-08T00:00:00Z",
"kind": "solar",
"type": "total",
"place": "partial: North and Central America; total: northern Mexico, central U.S., and eastern Canada"
},
"checkedAt": "2024-04-08T00:00:00Z"
}
```
If an error occurs during processing, the script will return a JSON error
message with details about the failure.
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
ejfox-eclipsetoday.web.val.run
Updated: August 23, 2024