Skip to content

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 ​

FLagLanguageShort representation
πŸ‡¬πŸ‡§Englishen
πŸ‡·πŸ‡ΊRussianru
πŸ‡ΊπŸ‡¦Ukrainianuk

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")