summaryrefslogtreecommitdiffstats
path: root/Solsnu.Widget/Utilities
diff options
context:
space:
mode:
authorivar <i@oiee.no>2026-03-24 12:31:46 +0100
committerivar <i@oiee.no>2026-03-24 12:31:46 +0100
commit35346562bd81412ab998e79f3a64eda2585c9e41 (patch)
tree6d5f991795509d7fa21918197f96ecf83291bab1 /Solsnu.Widget/Utilities
parentc0f84ad32693afed9d53a5962303e91172e95a3d (diff)
downloadsolverv-35346562bd81412ab998e79f3a64eda2585c9e41.tar.xz
solverv-35346562bd81412ab998e79f3a64eda2585c9e41.zip
refactor: rename calendar2 to currentCalendar for clarity
Diffstat (limited to 'Solsnu.Widget/Utilities')
-rw-r--r--Solsnu.Widget/Utilities/SunTimes.swift24
1 files changed, 12 insertions, 12 deletions
diff --git a/Solsnu.Widget/Utilities/SunTimes.swift b/Solsnu.Widget/Utilities/SunTimes.swift
index f8906ce..d3ca7fc 100644
--- a/Solsnu.Widget/Utilities/SunTimes.swift
+++ b/Solsnu.Widget/Utilities/SunTimes.swift
@@ -73,8 +73,8 @@ class SunTimes {
let sunsetLocal = sunsetUTC + tzOffset
// Step 9: Create date components, handling day boundary crossing
- let calendar2 = Calendar.current
- var baseComponents = calendar2.dateComponents([.year, .month, .day], from: date)
+ let currentCalendar = Calendar.current
+ var baseComponents = currentCalendar.dateComponents([.year, .month, .day], from: date)
// Sunrise
var sunriseComp = baseComponents
@@ -84,16 +84,16 @@ class SunTimes {
let srMinute = Int(srMinuteDouble)
if srHour < 0 {
- if let prevDay = calendar2.date(byAdding: .day, value: -1, to: date) {
- let prevComponents = calendar2.dateComponents([.year, .month, .day], from: prevDay)
+ if let prevDay = currentCalendar.date(byAdding: .day, value: -1, to: date) {
+ let prevComponents = currentCalendar.dateComponents([.year, .month, .day], from: prevDay)
sunriseComp = prevComponents
sunriseComp.hour = 24 + srHour
} else {
sunriseComp.hour = 0
}
} else if srHour >= 24 {
- if let nextDay = calendar2.date(byAdding: .day, value: 1, to: date) {
- let nextComponents = calendar2.dateComponents([.year, .month, .day], from: nextDay)
+ if let nextDay = currentCalendar.date(byAdding: .day, value: 1, to: date) {
+ let nextComponents = currentCalendar.dateComponents([.year, .month, .day], from: nextDay)
sunriseComp = nextComponents
sunriseComp.hour = srHour - 24
} else {
@@ -113,16 +113,16 @@ class SunTimes {
let ssMinute = Int(ssMinuteDouble)
if ssHour < 0 {
- if let prevDay = calendar2.date(byAdding: .day, value: -1, to: date) {
- let prevComponents = calendar2.dateComponents([.year, .month, .day], from: prevDay)
+ if let prevDay = currentCalendar.date(byAdding: .day, value: -1, to: date) {
+ let prevComponents = currentCalendar.dateComponents([.year, .month, .day], from: prevDay)
sunsetComp = prevComponents
sunsetComp.hour = 24 + ssHour
} else {
sunsetComp.hour = 0
}
} else if ssHour >= 24 {
- if let nextDay = calendar2.date(byAdding: .day, value: 1, to: date) {
- let nextComponents = calendar2.dateComponents([.year, .month, .day], from: nextDay)
+ if let nextDay = currentCalendar.date(byAdding: .day, value: 1, to: date) {
+ let nextComponents = currentCalendar.dateComponents([.year, .month, .day], from: nextDay)
sunsetComp = nextComponents
sunsetComp.hour = ssHour - 24
} else {
@@ -134,8 +134,8 @@ class SunTimes {
sunsetComp.minute = max(0, min(59, ssMinute))
sunsetComp.second = 0
- guard let sunriseDate = calendar2.date(from: sunriseComp),
- let sunsetDate = calendar2.date(from: sunsetComp) else {
+ guard let sunriseDate = currentCalendar.date(from: sunriseComp),
+ let sunsetDate = currentCalendar.date(from: sunsetComp) else {
return nil
}