From b4542a29aeeb3b4230d8c50ae85b3595c28d171a Mon Sep 17 00:00:00 2001 From: Fynn Kiwitt Date: Tue, 28 Sep 2021 18:42:51 +0200 Subject: [PATCH] created iso8601 calendar for determining weekOfYear (#369) --- TUM Campus App/Extensions/Extensions.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/TUM Campus App/Extensions/Extensions.swift b/TUM Campus App/Extensions/Extensions.swift index 85bea9ba..02cb3bb7 100644 --- a/TUM Campus App/Extensions/Extensions.swift +++ b/TUM Campus App/Extensions/Extensions.swift @@ -187,8 +187,10 @@ extension CLLocationCoordinate2D { extension Date { var calendar: Calendar { Calendar(identifier: Calendar.current.identifier) } - var weekOfYear: Int { calendar.component(.weekOfYear, from: self) } var weekOfMonth: Int { calendar.component(.weekOfMonth, from: self) } + + var isoCalendar: Calendar { Calendar(identifier: .iso8601) } + var weekOfYear: Int { isoCalendar.component(.weekOfYear, from: self) } var year: Int { get {