Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( NotYet = `not yet` JustNow = `just now` LastMinute = `1 minute ago` Minutes = `%d minutes ago` LastHour = `1 hour ago` Hours = `%d hours ago` Yesterday = `Yesterday` Days = `%d days ago` Weeks = `%d weeks ago` Months = `%d months ago` Years = `%d years ago` )
Texts to be translated if necessary.
Functions ¶
func Time ¶
Time returns in a human readable format the elapsed time since the given datetime.
Example ¶
package main
import (
"fmt"
"time"
"github.com/rvflash/elapsed"
)
func main() {
t := time.Now().Add(-time.Hour)
fmt.Println(elapsed.Time(t))
t = time.Now().Add(-time.Hour * 24 * 3)
fmt.Println(elapsed.Time(t))
t, _ = time.Parse("2006-02-01", "2049-08-19")
fmt.Println(elapsed.Time(t))
}
Output: 1 hour ago 3 days ago not yet
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.