re: Get the number of days between two dates in Go VIEW POST

VIEW FULL DISCUSSION
 
func daysBetween(a, b time.Time) int {
    if a.After(b) {
        a, b = b, a
    }
    return int(b.Sub(a).Hours() / 24)
}
 

Not quite as robust as I'd like. Not all days have 24 hours in them. 😔

code of conduct - report abuse