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/timeago
Supported languages β
FLag | Language | Short representation |
---|---|---|
π¬π§ | English | en |
π·πΊ | Russian | ru |
πΊπ¦ | Ukrainian | uk |
Usage β
For outputting post publishing date or something else you can just pass the date to function timeago.Take()
. It will count the interval between now and given date and returns converted format.
go
timeago.Take("2019-10-23 10:46:00") // after 10 seconds outputs: 10 seconds ago
If you want to show last user login like if user is online or not, you can optionally add |online
to the datetime string. All it does is just displaying Online if date interval withing 60 seconds.
go
timeago.Take("2019-10-23 10:46:00|online")