Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Commit

Permalink
created iso8601 calendar for determining weekOfYear (#369)
Browse files Browse the repository at this point in the history
  • Loading branch information
fkiwitt authored Sep 28, 2021
1 parent da600e4 commit b4542a2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion TUM Campus App/Extensions/Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit b4542a2

Please sign in to comment.