|
|
@ -43,7 +43,7 @@ public extension Date { |
|
|
|
* - returns: A TimeChunk representing the time between the dates, in natural form |
|
|
|
* - returns: A TimeChunk representing the time between the dates, in natural form |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
func chunkBetween(date: Date) -> TimeChunk { |
|
|
|
func chunkBetween(date: Date) -> TimeChunk { |
|
|
|
var compenentsBetween = Calendar.autoupdatingCurrent.dateComponents([.year, .month, .day, .hour, .minute, .second], from: self, to: date) |
|
|
|
let compenentsBetween = Calendar.autoupdatingCurrent.dateComponents([.year, .month, .day, .hour, .minute, .second], from: self, to: date) |
|
|
|
return TimeChunk(seconds: compenentsBetween.second!, minutes: compenentsBetween.minute!, hours: compenentsBetween.hour!, days: compenentsBetween.day!, weeks: 0, months: compenentsBetween.month!, years: compenentsBetween.year!) |
|
|
|
return TimeChunk(seconds: compenentsBetween.second!, minutes: compenentsBetween.minute!, hours: compenentsBetween.hour!, days: compenentsBetween.day!, weeks: 0, months: compenentsBetween.month!, years: compenentsBetween.year!) |
|
|
|
// TimeChunk(seconds: secondDelta, minutes: minuteDelta, hours: hourDelta, days: dayDelta, weeks: 0, months: monthDelta, years: yearDelta) |
|
|
|
// TimeChunk(seconds: secondDelta, minutes: minuteDelta, hours: hourDelta, days: dayDelta, weeks: 0, months: monthDelta, years: yearDelta) |
|
|
|
} |
|
|
|
} |
|
|
|