MatthewYork / DateTools

Dates and times made easy in iOS
MIT License
7.22k stars 952 forks source link

Bug with TimeAgo #306

Closed BrentMifsud closed 3 years ago

BrentMifsud commented 3 years ago

Test Case:

let oldEpoch = 1625693136.000 // Jul 7, 2021 5:25 PM
let currentEpoch = 1625862719.98203 // Jul 9, 2021 4:31 PM

let oldDate = Date(timeIntervalSince1970: oldEpoch)
let newDate = Date(timeIntervalSince1970: currentEpoch)

print(oldDate.timeAgo(since: newDate)) // prints 23 hours

am I losing my mind? Shouldn't it be 1 day 23 hours?

BrentMifsud commented 3 years ago

closing this. Duplicate of: #243