xeonx / timeago

Go package for time formating based on current time (eg: "3 hours ago")

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

timeago - A time formatting package

Install

go get github.com/xeonx/timeago

Docs

You can see the docs page here

Use

package main

import (
 "time"

 "github.com/xeonx/timeago"
)

func main() {
 t := time.Now().Add(42 * time.Second)

 // 's' will contain "less than a minute ago"
 s := timeago.English.Format(t)

 //...
}

Tests

go test is used for testing.

About

Go package for time formating based on current time (eg: "3 hours ago")

License:MIT License


Languages

Language:Go 100.0%