Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AstronomicalConstant to TinyMoon + Move files around #22

Merged
merged 12 commits into from
Jun 8, 2024

Conversation

mannylopez
Copy link
Owner

Closes #10

Does the heavy lifting of incorporating #18 AstronomicalConstant work and using those calculations to power TinyMoon under the hood.

Also added ExactMoon since I now have a concept of a more "traditional' moon API that returns a full day's worth of phase, instead of very exact phases.

/// The `ExactMoon` object for a specific date and time.
///
/// This object represents the precise moon phase for a given date and time, without prioritizing major moon phases 
// (new moon, first quarter, full moon, last quarter)  over others. It provides a more detailed and accurate representation 
// of the moon's phase, suitable for applications requiring precise lunar data.
///
/// Use `exactMoonPhase` when the specificity of the lunar phase is critical to your application, such as in astronomical apps 
// or detailed lunar tracking that rely on precise moon phase calculations.
///
/// - Note: Unlike `moonPhase`, which may prioritize major moon phases occurring at any point within a 24-hour period, 
// `exactMoonPhase` focuses on the exact lunar phase at the given moment.
///
/// For example, given that the full moon occurs on `August 19, 2024 at 13:25 UTC` and the date we query for is `August 19, 
// 2024 at 00:00 UTC`, this object will return `.waxingGibbous` because that is a more accurate representation of the moon 
// phase at `00:00 UTC` time.
/// The `Moon` object for a specific date, prioritizing major phases.
///
/// Use this object when you need a general understanding of the moon's phase for a day, especially when emphasizing the 
// major phases is important for your application's context.
///
/// If one of the major moon phases (new moon, first quarter, full moon, last quarter) occurs at any time within the 24-hour 
// period of the specified date, this object will reflect that major moon phase.
///
/// If no major moon phase occurs within the date's 24 hours (starting at 00:00 and ending at 23:59), the object will 
// represent the moon phase closest to the specified date and time.
///
/// - Note: Unlike `ExactMoon`, this object will prioritize major moon phases occurring at any point within a 24-hour period.

Previous API properties (name, moonPhase, isFullMoon, emoji, date) stays the same

mannylopez added 12 commits June 6, 2024 13:18
Adds the following functions and tests
- moonPhase(julianDay: Double, phaseFraction: Double) -> MoonPhase
- dayIncludesMajorMoonPhase(julianDay: Double) -> MoonPhase?
- startAndEndOfJulianDay(julianDay: Double) -> (start: Double, end: Double)
- majorMoonPhaseInRange(start: Double, end: Double) -> MoonPhase?
- func minorMoonPhase(phaseFraction: Double) -> MoonPhase
- exactMoonPhase(phaseFraction: Double)
…e tests

Add ExactMoon, add new initializers for it, separate out Moon vs ExactMoon
@mannylopez mannylopez changed the title Use astronomical constant Add AstronomicalConstant to TinyMoon + Move files around Jun 8, 2024
@mannylopez mannylopez merged commit 2f013f2 into main Jun 8, 2024
@mannylopez mannylopez deleted the use-astronomical-constant branch June 8, 2024 04:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test all Moon methods
1 participant