feat(schedules): add sunset() for the sunsets seen from a place on Earth in @observerly/orderly - #70
Merged
Merged
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Two updated doc comments (in src/schedules/sun.ts and README.md) appear inconsistent with the repository’s existing pole behavior tests for sunrise().
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds a new sunset(observer) schedule alongside the existing sunrise() schedule, exposing it through the public exports and documenting/validating its day-by-day walk behavior (including edge-of-Date-range behavior) with dedicated tests.
Changes:
- Add
sunset()schedule implemented via the existing shared day-walk logic insrc/schedules/sun.ts. - Add comprehensive
vitestcoverage for sunset behavior across dates, longitudes, polar conditions, and Date-range horizons. - Update README and ship a minor changeset to document and publish the new API.
File summaries
| File | Description |
|---|---|
src/schedules/sun.ts |
Adds getSunset integration and exports sunset() via the existing walk/validation logic; updates related explanatory comments. |
src/schedules/index.ts |
Re-exports sunset from the schedules package surface. |
src/index.ts |
Re-exports sunset from the library’s top-level API. |
tests/sunset.spec.ts |
Adds functional/purity/validation tests for sunset() in common scenarios. |
tests/sunset-horizons.spec.ts |
Adds polar-day/night and Date-range horizon tests for sunset() (including far-west behavior). |
README.md |
Documents sunset() in the “At a Glance” table and “The Sun” section with example usage. |
.changeset/add-sunset.md |
Declares a minor release for the new exported schedule. |
Review details
- Files reviewed: 7/7 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…rth in @observerly/orderly
michealroberts
force-pushed
the
feature/schedules/sunset
branch
from
September 8, 2026 18:51
479d20b to
c2534aa
Compare
| expect(sunset(LONDON).next(SOLSTICE)).toStrictEqual(SET_ON_THE_SOLSTICE); | ||
| }); | ||
|
|
||
| it("is the next day's once the day's has passed", () => { |
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What This Changes
sunset(observer), the mirror ofsunrise(): the sunsets seen from a place on Earth, one a day on the days the Sun sets, resolved with@observerly/astrometryto the standard almanac convention, the upper limb of the Sun touching the horizon as it sets. It is one export on the walkersunrise()introduced, with the sameObservervalidation, the same strictly-after walk past polar days and nights, and the same 400-day bound before exhausting.Notes For Reviewers
Invalid time value.prefer-readonly-parameter-typeswarning, on the new export's parameter, the same one every schedule constructor carries. No other warning is new.Checklist