Skip to content

Commit

Permalink
support milliseconds
Browse files Browse the repository at this point in the history
  • Loading branch information
Elyahu41 committed Dec 26, 2023
1 parent 5e0e756 commit 7758acb
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 7 deletions.
Binary file added .DS_Store
Binary file not shown.
Binary file added Sources/.DS_Store
Binary file not shown.
14 changes: 10 additions & 4 deletions Sources/KosherSwift/AstronomicalCalendar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -553,13 +553,19 @@ public class AstronomicalCalendar {

let hours = Int(calculatedTime)
calculatedTime -= Double(hours)
let minutes = Int(calculatedTime * 60)
calculatedTime -= Double(minutes) / 60
let seconds = Int(calculatedTime * 3600)


calculatedTime = calculatedTime * 60
let minutes = Int(calculatedTime)
calculatedTime -= Double(minutes)

calculatedTime = calculatedTime * 60
let seconds = Int(calculatedTime)
calculatedTime -= Double(seconds)

components.hour = hours
components.minute = minutes
components.second = seconds
components.nanosecond = Int(calculatedTime * 1000 * 1000000)

var returnDate = gregorianCalendar.date(from: components)

Expand Down
4 changes: 2 additions & 2 deletions Sources/KosherSwift/ComplexZmanimCalendar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3048,8 +3048,8 @@ public class ComplexZmanimCalendar : ZmanimCalendar {
}

/**
* Method to return <em>tzais</em> (dusk) calculated as 13.5 minutes zmaniyos.
*
* Method to return <em>tzais</em> (dusk) calculated as 13.5 minutes zmaniyos after sunset.
* - Warning: This zman is EXTREMELY early! It is so early that it was removed from KosherJava since it caused a situation the developer, Eliyahu Hershfeld, was uncomfortable with. The situation was in Canada where a user using his phone saw that this time was listed as the time for nightfall, and he figured that he could end shabbos then. Whie there are no poskim that write to do that! The earliest time that I have found to end shabbos is 20 regular minutes after sunset and that is only in Israel and the surrounding areas. Every where else was recommended 30 minutes at the bare minimum. Therefore, someone who wants to use/include this time has an obligation to make sure that it does not get used for shabbos by dimming it or showing another time.
* @return the <code>Date</code> representing the time. If the calculation can't be computed such as in the Arctic
* Circle where there is at least one day a year where the sun does not rise, and one where it does not set,
* a <code>nil</code> will be returned. See detailed explanation on top of the ``AstronomicalCalendar``
Expand Down
Binary file added Tests/.DS_Store
Binary file not shown.
1 change: 0 additions & 1 deletion Tests/KosherSwiftTests/KosherSwiftTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,6 @@ class KosherSwiftTests: XCTestCase {
let calculator = ComplexZmanimCalendar(location: geoLocation)
let format = DateFormatter()
format.timeStyle = .full
calculator.astronomicalCalculator = SunTimesCalculator()
print(format.string(from: calculator.getSeaLevelSunrise()!))
print(format.string(from: calculator.getSeaLevelSunset()!))
}
Expand Down

0 comments on commit 7758acb

Please sign in to comment.