mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-22 01:22:46 +02:00
Use Calendar to compute target dates
This commit is contained in:
@@ -142,8 +142,10 @@ extension PollHistoryViewModel.Context {
|
||||
}
|
||||
}
|
||||
|
||||
var syncedPastDays: UInt {
|
||||
let timeDelta = max(viewState.syncStartDate.timeIntervalSince(viewState.syncedUpTo), 0)
|
||||
return UInt((timeDelta / PollHistoryConstants.oneDayInSeconds).rounded())
|
||||
var syncedPastDays: Int {
|
||||
guard let days = Calendar.current.dateComponents([.day], from: viewState.syncedUpTo, to: viewState.syncStartDate).day else {
|
||||
return 0
|
||||
}
|
||||
return max(0, days)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user