# README
Elapsed time
Golang package to return the elapsed time since a given time in a human-readable format.
Installation
$ go get -u github.com/rvflash/elapsed
Usage
t := time.Now().Add(-time.Hour)
fmt.Println(elapsed.Time(t))
// Output: 1 hour ago
t = time.Now().Add(-time.Hour * 24 * 3)
fmt.Println(elapsed.Time(t))
// Output: 3 days ago
t, _ = time.Parse("2006-02-01", "2049-08-19")
fmt.Println(elapsed.Time(t))
// Output: not yet
t = time.Now().Add(-time.Hour * 24 * 3)
fmt.Println(elapsed.LocalTime(t, "fr"))
// Output: il y a 3 jours
# Functions
AddTranslation adds the terms for the given language code.
LocalTime returns in a human readable format the elapsed time since the given datetime using the given ISO 639-1 language code.
Time returns in a human readable format the elapsed time since the given datetime in english.
# Constants
Days is the translation ID for the "%d days ago" text.
Hour is the singular of Hours.
Hours is the translation ID for the "%d hours ago" text.
JustNow is the translation ID for the "just now" text.
Minute is the translation ID for the "1 minute ago" text.
Minutes is the translation ID for the "%d minutes ago" text.
Month is the singular of Months.
Months is the translation ID for the "%d months ago" text.
NotYet is the translation ID for the "not yet" text.
Week is the singular of Weeks.
Weeks is the translation ID for the "`%d weeks ago" text.
Year is the singular.
Years is the translation ID for the "%d years ago" text.
Yesterday is the translation ID for the "yesterday" text.
# Type aliases
Lists all translations by identifier.
Lists all translations by language code.
TrID is the ID of a translation.