Repository navigation
Releases: bhargavkukadiya/ChoghadiyaKit
Release list
v1.1.0: Offline Solar Engine and Vedic Periods
Added
- Offline Solar Engine (
NOAASunTimesCalculator): Pure Swift NOAA solar position algorithm computing sunrise, sunset, and next sunrise from coordinates with no network access, including a synchronoussunTimes(latitude:longitude:timeZone:date:). Applies the same time zone, date line, polar, and coordinate checks asAPISunTimesFetcher. Sunrise and sunset are located by searching for the actual horizon crossing, so the last sunrise before the midnight sun (for example 00:51 in Tromsø on 2026-05-18) and a sunset after midnight are still found, and a next day with no sunset of its own does not block the current schedule. - Rahu Kaal, Yamagandam & Gulika Kaal (
VedicPeriodCalculator): NewVedicPeriodandVedicPeriodTypemodels, plusChoghadiyaSchedule.vedicPeriodsandvedicPeriod(_:), computed from the schedule's sunrise and sunset and the Vedic weekday. - CLI
--offlineOption & Period Listing: Compute solar times offline, and list the day's Rahu Kaal, Yamagandam, and Gulika Kaal. - New
ChoghadiyaErrorcases:timeZoneUnavailable,timeZoneMismatch, andpolarDayOrNight. Exhaustiveswitchstatements overChoghadiyaErrorneed to handle them. - CLI Time Zone Lookup: Coordinates given without a time zone now use the coordinates' own time zone (looked up by reverse geocoding) instead of the system time zone.
- CLI Attribution: Show the Sunrise-Sunset.org data link in the CLI output.
Fixed
- Wrong Vedic Weekday for Mismatched Time Zones (
APISunTimesFetcher): Reject a time zone that would put sunrise on a different weekday than the location's longitude implies (for example Honolulu withAsia/Tokyo), instead of silently returning the next weekday's schedule. Date-line zones such as Kiribati, Samoa, and Tonga are accepted only for coordinates inside their own territory. - Silent Time Zone Fallback: Geocoded locations without a time zone now throw
timeZoneUnavailableinstead of using the device's time zone, in both the library and the CLI. - Polar Day / Night: Detect the API's Unix-epoch placeholder times and throw
polarDayOrNight, instead of re-querying a date decades away and reporting inconsistent sun times. - CLI Date Parsing: Reject malformed
--datevalues such as2026--10-24,2026-10-24-, and2026-+1-24.
Changed
- Documentation: Document that coordinate-based calls need the location's own time zone and the new errors; note that
currentSlot()isnilbetween midnight and sunrise on that date's schedule; replace the static CI badge with the live workflow badge; correct the Diwali 2026 example date, the test count, and a README snippet that redeclaredschedule.
Validation
- 66 tests pass with complete strict concurrency checking, including full-year horizon scans across polar transitions.
- An additional independent event search checked 78,840 daily cases across both hemispheres, date-line locations, and daylight-saving changes with no mismatches against the same solar-position model.
Upgrading from 1.0.x
Update exhaustive switches over ChoghadiyaError to handle timeZoneUnavailable, timeZoneMismatch, and polarDayOrNight.
Full changelog: v1.0.2...v1.1.0
v1.0.2
What’s changed
- Reject malformed comma-separated coordinates instead of silently parsing incomplete values.
- Add a precompiled macOS Apple Silicon CLI binary.
Downloads
ChoghadiyaDemo-macos-arm64— standalone executableChoghadiyaDemo-macos-arm64.zip— executable, license, and quick-start instructionschecksums.txt— SHA-256 checksums for both downloads
Run the standalone binary with chmod +x ChoghadiyaDemo-macos-arm64, then ./ChoghadiyaDemo-macos-arm64 --help.
Full Changelog: v1.0.1...v1.0.2
v1.0.1
🕉️ ChoghadiyaKit 1.0.1
A modern, thread-safe Swift framework for astronomical Vedic Choghadiya (auspicious time) calculations across Apple platforms (iOS, macOS, watchOS, tvOS).
Version 1.0.1 brings deterministic calendar calculations across non-Gregorian device locales, direct solar boundary accessors, IEEE 754 solar validation, fail-fast error handling, and hardened CLI argument parsing.
✨ Highlights
- Astronomical Solar Accessors: Query
schedule.sunrise,schedule.sunset, andschedule.nextSunrisedirectly onChoghadiyaSchedulewithout manual slot indexing. - Deterministic Calendar Calculation: Guaranteed deterministic Vedic day calculations across all user device calendars and locales (e.g. Buddhist, Islamic, Hebrew, Japanese) by explicitly anchoring internal calculations to Gregorian
Calendar. - Solar Boundary & IEEE 754 Validation: Hardened
SunTimes.isValidwith.isFinitetimestamp and duration checks alongside strict chronological ordering (sunrise < sunset < nextSunrise). - Fail-Fast Error Handling & Safe Fallbacks:
ChoghadiyaManagerthrows typedChoghadiyaError.invalidSunTimeswhen astronomical solar times are invalid;ChoghadiyaCalculatorgracefully returns an empty schedule. - Resilient CLI Demo & New Formats:
ChoghadiyaDemodisplays formatted Sunrise/Sunset timestamps in the banner, supports comma-separated coordinate syntax (<lat>,<lon> [<timezone>]), and strictly rejects duplicate flags or mismatched options. - Swift 6 Strict Concurrency: 100% thread-safe value semantics (
Sendablethroughout) with zero compiler warnings under-strict-concurrency=complete. - 100% Tested: 37 automated unit tests covering all 7 weekdays, slot continuity, coordinate validation, solar day normalization, and boundary edge cases.
💻 Installation (Swift Package Manager)
Add ChoghadiyaKit to your Package.swift:
dependencies: [
.package(url: "https://github.com/bhargavkukadiya/ChoghadiyaKit.git", from: "1.0.1")
]Or in Xcode: File → Add Package Dependencies... and enter:
https://github.com/bhargavkukadiya/ChoghadiyaKit.git
⚡ Quick Start
1. By City Name
import Foundation
import ChoghadiyaKit
let manager = ChoghadiyaManager()
let schedule = try await manager.getSchedule(for: "Ahmedabad, India")
// Direct Solar Boundaries
if let sunrise = schedule.sunrise, let sunset = schedule.sunset {
print("Sunrise: \(sunrise), Sunset: \(sunset)")
}
// Active Slot Right Now
if let current = schedule.currentSlot() {
print("Active Now: \(current.type.rawValue) (\(current.type.auspiciousness.rawValue))")
print("Ruling Graha: \(current.type.rulingPlanet)")
print("Window: \(current.startTime) – \(current.endTime)")
}2. By Coordinates (WidgetKit & CoreLocation)
import CoreLocation
import ChoghadiyaKit
let manager = ChoghadiyaManager()
let coordinate = location.coordinate // CLLocationCoordinate2D
let schedule = try await manager.getSchedule(coordinate: coordinate, timeZone: .current)
for slot in schedule.daySlots {
print("\(slot.type.rawValue): \(slot.startTime) - \(slot.endTime)")
}3. By Specific Calendar Date
let schedule = try await manager.getSchedule(
for: "Ahmedabad, India",
date: futureDate
)🖥️ Live Terminal CLI Demo
Test calculations immediately from your terminal without writing code:
# Today's schedule (Ahmedabad default):
swift run ChoghadiyaDemo
# Any city worldwide:
swift run ChoghadiyaDemo "London, UK"
# Direct coordinates (space-separated or comma-separated):
swift run ChoghadiyaDemo 23.0225 72.5714 Asia/Kolkata
swift run ChoghadiyaDemo 23.0225,72.5714 Asia/Kolkata
# Explicit flags with custom timezone:
swift run ChoghadiyaDemo --lat 40.7128 --lon -74.0060 --tz America/New_York
# Specific calendar date:
swift run ChoghadiyaDemo "Ahmedabad, India" --date 2026-10-24
# View all options:
swift run ChoghadiyaDemo --help📦 Attached Binaries & Verification
Download the pre-compiled command-line binary for macOS Apple Silicon:
ChoghadiyaDemo-macos-arm64.zipchecksums.txt(SHA-256)
Full Changelog: v1.0.0...v1.0.1
v1.0.0
🕉️ ChoghadiyaKit 1.0.0
A modern, thread-safe Swift framework for astronomical Vedic Choghadiya (auspicious time) calculations across Apple platforms (iOS, macOS, watchOS, tvOS).
✨ Highlights
- Vedic Planetary Divisions: Computes all 16 planetary hours (8 Day, 8 Night) based on astronomical solar sunrise and sunset.
- Swift 6 Strict Concurrency: 100% thread-safe value semantics (
Sendablethroughout) with zero compiler warnings under-strict-concurrency=complete. - Zero Third-Party Dependencies: Built exclusively on native Apple SDKs (
Foundation,CoreLocation). - Flexible Coordinates & Address Lookup: Query by city name (e.g.
"Ahmedabad, India") or directly usingCLLocationCoordinate2D(ideal for WidgetKit & CoreLocation). - Historical & Future Dates: Query any calendar date (
--date YYYY-MM-DDor SwiftDate()) with automatic solar adjustments. - Interactive CLI Demo: Built-in executable runner (
swift run ChoghadiyaDemo) or standalone terminal binary. - 100% Tested: 21 automated unit tests verifying planetary sequences across all 7 weekdays.
💻 Installation (Swift Package Manager)
Add ChoghadiyaKit to your Package.swift:
dependencies: [
.package(url: "https://github.com/bhargavkukadiya/ChoghadiyaKit.git", from: "1.0.0")
]Or in Xcode: File → Add Package Dependencies... and enter:
https://github.com/bhargavkukadiya/ChoghadiyaKit.git
⚡ Quick Start
1. By City Name
import Foundation
import ChoghadiyaKit
let manager = ChoghadiyaManager()
let schedule = try await manager.getSchedule(for: "Ahmedabad, India")
if let current = schedule.currentSlot() {
print("Active Now: \(current.type.rawValue) (\(current.type.auspiciousness.rawValue))")
print("Ruling Graha: \(current.type.rulingPlanet)")
print("Window: \(current.startTime) – \(current.endTime)")
}2. By Coordinates (WidgetKit & CoreLocation)
import CoreLocation
import ChoghadiyaKit
let manager = ChoghadiyaManager()
let coordinate = location.coordinate // CLLocationCoordinate2D
let schedule = try await manager.getSchedule(coordinate: coordinate, timeZone: .current)
for slot in schedule.daySlots {
print("\(slot.type.rawValue): \(slot.startTime) - \(slot.endTime)")
}3. By Specific Calendar Date
let schedule = try await manager.getSchedule(
for: "Ahmedabad, India",
date: futureDate
)🖥️ Live Terminal CLI Demo
Test calculations immediately from your terminal without writing code:
# Today's schedule (Ahmedabad default):
swift run ChoghadiyaDemo
# Any city worldwide:
swift run ChoghadiyaDemo "London, UK"
# Direct coordinates:
swift run ChoghadiyaDemo 21.1702 72.8311 Asia/Kolkata
# Specific calendar date:
swift run ChoghadiyaDemo "Ahmedabad, India" --date 2026-10-24
# View all options:
swift run ChoghadiyaDemo --help📦 Attached Binaries & Verification
Download the pre-compiled command-line binary for macOS Apple Silicon:
ChoghadiyaDemo-macos-arm64.zipchecksums.txt(SHA-256)