Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion DateToolsSwift/DateTools/TimePeriod.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,18 @@ public extension TimePeriodProtocol {
}
return Int.max
}


/**
* The duration of the `TimePeriod` in months.
* Returns the max int if beginning or end are nil.
*/
public var months: Int {
if self.beginning != nil && self.end != nil {
return self.beginning!.monthsEarlier(than: self.end!)
}
return Int.max
}

/**
* The duration of the `TimePeriod` in weeks.
* Returns the max int if beginning or end are nil.
Expand Down