Retrieve the dates and UTC times of the four principal moon phases for a requested month or year.
Use Cases
Use to look up a new moon, first quarter, full moon, or last quarter in a particular month or year. Filter the extracted entries by phase or date if requested.
Automation Flow
- Build
https://www.moongiant.com/moonphases/{month}/{year}/with a lowercase English month name, such asaugust, and a four-digit year. - Navigate directly to the URL, then run this evaluator on the loaded page:
(() => {
const match = location.pathname.match(/^\/moonphases\/([a-z]+)\/(\d{4})\/?$/i);
if (!match) return { month: null, year: null, phases: [] };
const [, month, year] = match;
const text = document.body.innerText.replace(/\s+/g, ' ');
const phases = [...text.matchAll(/(New Moon|First Quarter|Full Moon|Last Quarter) ([A-Z][a-z]+ \d{1,2}) (\d{1,2}:\d{2} UTC)/g)]
.map(([, phase, date, timeUtc]) => ({ phase, date: `${date}, ${year}`, timeUtc }));
return { month, year: Number(year), phases: [...new Map(phases.map(p => [`${p.phase}|${p.date}`, p])).values()] };
})()- For a whole year, run the evaluator for each of the 12 months and combine the
phasesarrays. Check that each page returned the requested month and year and a populated phase list before treating the result as complete.
Possible Friction Points
/phase/{phase}/{year}/can return today's moon phase rather than a historical calendar. Use/moonphases/{month}/{year}/.- A phase can occur twice in one month. Keep entries with distinct dates, and preserve the displayed UTC times.
Example Result
{
"month": "august",
"year": 2023,
"phases": [
{ "phase": "Full Moon", "date": "August 1, 2023", "timeUtc": "18:31 UTC" },
{ "phase": "Last Quarter", "date": "August 8, 2023", "timeUtc": "10:28 UTC" },
{ "phase": "New Moon", "date": "August 16, 2023", "timeUtc": "09:38 UTC" },
{ "phase": "First Quarter", "date": "August 24, 2023", "timeUtc": "09:57 UTC" },
{ "phase": "Full Moon", "date": "August 31, 2023", "timeUtc": "01:35 UTC" }
]
}