Outdated version
You are viewing the outdated version of Timeago library. Switch to the latest version to get all the new features and improvements
Get Started β
Quick Start β
bash
go get -u github.com/SerhiiCho/timeagoSupported languages β
| Flag | Language | Short representation |
|---|---|---|
| π¬π§ | English | en |
| π·πΊ | Russian | ru |
| πΊπ¦ | Ukrainian | uk |
Usage β
For outputting post publishing date or other content, you can just pass the date to the timeago.Take() function. It will calculate the interval between now and the given date and return the converted format.
go
timeago.Take("2019-10-23 10:46:00") // after 10 seconds outputs: 10 seconds agoIf you want to show last user login status (whether the user is online or not), you can optionally add |online to the datetime string. This will display Online if the date interval is within 60 seconds.
go
timeago.Take("2019-10-23 10:46:00|online")