Skip to content

Commit

Permalink
follow up fix
Browse files Browse the repository at this point in the history
  • Loading branch information
LEOYoon-Tsaw committed Nov 7, 2021
1 parent 7b7da8a commit 9d47ca3
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions ChineseTime/Model.swift
Original file line number Diff line number Diff line change
Expand Up @@ -557,13 +557,8 @@ class ChineseCalendar {
}
var eventInHour: CelestialEvent {
let currentHour = self.currentHour
let hourStart = _calendar.date(bySettingHour: Int(currentHour / 2) * 2, minute: 0, second: 0, of: _time)!
let nextHourStart: Date
if currentHour / 2 < 11 {
nextHourStart = _calendar.date(bySettingHour: (Int(currentHour / 2)+1) * 2, minute: 0, second: 0, of: _time)!
} else {
nextHourStart = _calendar.startOfDay(for: _calendar.date(byAdding: .day, value: 1, to: _time)!)
}
let hourStart = _time.advanced(by: -(currentHour % 2.0) * 3600)
let nextHourStart = hourStart.advanced(by: 7200)
var event = CelestialEvent()
event.eclipse = _moonEclipses.filter { hourStart <= $0 && nextHourStart > $0 }.map { date in
hourStart.distance(to: date) / 7200
Expand Down

0 comments on commit 9d47ca3

Please sign in to comment.