{"id":20625097,"url":"https://github.com/jasonsturges/lunarphase-js","last_synced_at":"2025-10-27T13:31:59.868Z","repository":{"id":43180479,"uuid":"334343210","full_name":"jasonsturges/lunarphase-js","owner":"jasonsturges","description":"Calculate phase of the moon using Julian date","archived":false,"fork":false,"pushed_at":"2024-03-01T22:53:58.000Z","size":404,"stargazers_count":104,"open_issues_count":19,"forks_count":15,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-09T15:02:31.101Z","etag":null,"topics":["astronomy","emoji","julian","lunar-phases","moon","npm"],"latest_commit_sha":null,"homepage":"https://jasonsturges.github.io/lunarphase-js/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jasonsturges.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-30T06:18:38.000Z","updated_at":"2025-04-03T04:27:21.000Z","dependencies_parsed_at":"2024-02-28T06:31:50.653Z","dependency_job_id":"83d418aa-ff56-4788-8a5b-dc6a84bed38c","html_url":"https://github.com/jasonsturges/lunarphase-js","commit_stats":{"total_commits":133,"total_committers":2,"mean_commits":66.5,"dds":0.007518796992481258,"last_synced_commit":"464175045822030f43045f8830a0394b69a4df84"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonsturges%2Flunarphase-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonsturges%2Flunarphase-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonsturges%2Flunarphase-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonsturges%2Flunarphase-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jasonsturges","download_url":"https://codeload.github.com/jasonsturges/lunarphase-js/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248055275,"owners_count":21040156,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["astronomy","emoji","julian","lunar-phases","moon","npm"],"created_at":"2024-11-16T13:08:08.042Z","updated_at":"2025-10-27T13:31:59.798Z","avatar_url":"https://github.com/jasonsturges.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lunar phase\nCalculate phase of the moon using Julian date.\n  \n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/jasonsturges/lunarphase-js/raw/main/public/moon.png\" width=\"256px\" height=\"auto\" /\u003e\n\u003c/p\u003e\n\n\n# Getting Started\n\nTo install, execute:\n\n    npm i lunarphase-js\n\nThen, import into a project and use as:\n\n```js\nimport { Moon } from \"lunarphase-js\";\n\nconst phase = Moon.lunarPhase();\n```\n\nThis package provides for following distributables:\n- CJS: CommonJS\n- ESM: ES Modules \n- UMD: Universal Module Definition (browser)\n- IIFE: Immediately invoked function expression\n- TypeScript declaration types\n\n\n# Usage\n\nIn the lunar calendar there are 8 phases each synodic month, which is the number of days to complete the cycle. This time between two identical syzygies is equivalent to 29.53059 Earth days.\n\nLunar phases, in order:\n\n| Phase           | Northern Hemisphere | Southern Hemisphere |\n| --------------- | ------------------- | ------------------- |\n| New             | 🌑                  | 🌑                  |\n| Waxing Crescent | 🌒                  | 🌘                  |\n| First Quarter   | 🌓                  | 🌗                  |\n| Waxing Gibbous  | 🌔                  | 🌖                  |\n| Full            | 🌕                  | 🌕                  |\n| Waning Gibbous  | 🌖                  | 🌔                  |\n| Last Quarter    | 🌗                  | 🌓                  |\n| Waning Crescent | 🌘                  | 🌒                  |\n\n\n# API Reference:\n\nThe following functions are exported from `Moon`:\n\n| Function          | Output              | Description                                           |\n| ----------------- | ------------------- | ----------------------------------------------------- |\n| lunarPhase()      | Waxing Gibbous      | Get lunar phase for a given date                      |\n| lunarPhaseEmoji() | 🌖                  | Get emoji of lunar phase for a given date             |\n| isWaxing()        | true                | Whether the moon is waxing                            |\n| isWaning()        | false               | Whether the moon is waning                            |\n| lunarAge()        | 11.367344279004676  | Earth days since the last new moon                    |\n| lunarAgePercent() | 0.38497186542446116 | Percentage through the lunar synodic month            |\n| lunarDistance()   | 56.04166690080031   | Distance to the moon measured in units of Earth radii |\n| lunationNumber()  | 1217                | Brown Lunation Number (BLN)                           |\n\nVisit this repository's GitHub Pages for a live example: https://jasonsturges.github.io/lunarphase-js/\n\nAll functions default to the current date, as in \"now\":\n\n```js\nimport { Moon } from \"lunarphase-js\";\n\nconst phase = Moon.lunarPhase();\n```\n\nOtherwise, pass a date object to each function for a specific date.\n\n```js\nimport { Moon } from \"lunarphase-js\";\n\nconst date = new Date();\nconst phase = Moon.lunarPhase(date);\n```\n\n\n### Lunar Phase\n\nTo get the current lunar phase from the `LunarPhase` enum (ex: \"FULL\")\n\n```js\nconst phase = Moon.lunarPhase();\n```\n\n\n### Lunar Phase Emoji\n\nTo get the current lunar phase emoji from the `LunarEmoji` (ex: \"🌕\"):\n\n```js\nconst phaseEmoji = Moon.lunarPhaseEmoji();\n```\n\nAs phases are inverted between Northern and Southern Hemispheres, optionally pass `Hemisphere` options.\n\n```js\nimport { Hemisphere, Moon } from \"lunarphase-js\";\n\nconst date = new Date();\nMoon.lunarPhaseEmoji(date, {\n  hemisphere: Hemisphere.SOUTHERN,\n});\n```\n\nTo get emoji for other lunar phases, pass a `LunarPhase` enum:\n\n```js\nimport { LunarPhase, Moon } from \"lunarphase-js\";\n\nconst emoji = Moon.emojiForLunarPhase(LunarPhase.FULL);\n```\n\nOptionally pass a `Hemisphere` to the function:\n\n```js\nimport { Hemisphere, LunarPhase, Moon } from \"lunarphase-js\";\n\nconst emoji = Moon.emojiForLunarPhase(LunarPhase.FULL, {\n  hemisphere: Hemisphere.SOUTHERN,\n});\n\n```\n\n\n### Waxing\n\nWhether the moon is waxing (ex: false)\n\n```js\nconst waxing = Moon.isWaxing();\n```\n\n\n### Waning\n\nWhether the moon is waning (ex: true)\n\n```js\nconst waning = Moon.isWaning();\n```\n\n\n### Lunar Age\n\nAge in Earth days through the current lunar cycle, equivalent to 29.53059 Earth days, based on Mean Synodic Month, 2000 AD mean solar days.\n\n| Phase           | Start          | Event          | End            |\n| --------------- | -------------- | -------------- | -------------- |\n| New             |                | 0              | 1.84566173161  |\n| Waxing Crescent | 1.84566173161  | 3.69132346322  | 5.53698519483  |\n| First Quarter   | 5.53698519483  | 7.38264692644  | 9.22830865805  |\n| Waxing Gibbous  | 9.22830865805  | 11.07397038966 | 12.91963212127 |\n| Full            | 12.91963212127 | 14.76529385288 | 16.61095558449 |\n| Waning Gibbous  | 16.61095558449 | 18.4566173161  | 20.30227904771 |\n| Last Quarter    | 20.30227904771 | 22.14794077932 | 23.99360251093 |\n| Waning Crescent | 23.99360251093 | 25.83926424254 | 27.68492597415 |\n| New             | 27.68492597415 | 29.53058770576 |                |\n\nTo get the lunar age (ex: 16.54412413414952)\n\n```js\nconst age = Moon.lunarAge();\n```\n\n\n### Lunar Age Percent\n\nTo get the percentage through the lunar cycle (ex: 0.5602368519132597)\n\n```js\nconst agePercent = Moon.lunarAgePercent();\n```\n\n\n### Lunation Number\n\nBrown Lunation Number (BLN), per Ernest William Brown's lunar theory, defining Lunation 1 as the first new moon of 1923 at approximately 02:41 UTC, January 17, 1923\n\n```js\nconst lunationNumber = Moon.lunationNumber();\n```\n\n\n### Lunar Distance\n\nDistance to the moon measured in units of Earth radii, with perigee at 56 and apogee at 63.8.\n\n```js\nconst distance = Moon.lunarDistance();\n```\n\n\n## Julian\n\nConvert to and from Gregorian Dates to Julian Days via the `Julian` module.\n\nAPI Reference:\n\n| Function   | Output                   | Description                |\n| ---------- | ------------------------ | -------------------------- |\n| fromDate() | 2459357.5380029744       | Convert date to Julian Day |\n| toDate()   | 2021-05-23T05:56:10.418Z | Convert Julian Day to date |\n\nTo convert a date to Julian day:\n\n```js\nimport { Julian } from \"lunarphase-js\";\n\nconst date = new Date();\nconst julian = Julian.fromDate(date);\n```\n\nTo convert a Julian day to a date:\n\n```js\nimport { Julian } from \"lunarphase-js\";\n\nconst julian = 2459356.529302257;\nconst date = Julian.toDate(julian);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasonsturges%2Flunarphase-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjasonsturges%2Flunarphase-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasonsturges%2Flunarphase-js/lists"}