https://github.com/mrinjamul/go-timeago
go-timeago will evaluate time and return that time in words.
https://github.com/mrinjamul/go-timeago
Last synced: 8 months ago
JSON representation
go-timeago will evaluate time and return that time in words.
- Host: GitHub
- URL: https://github.com/mrinjamul/go-timeago
- Owner: mrinjamul
- License: bsd-3-clause
- Created: 2021-04-10T20:21:18.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2023-01-19T04:19:28.000Z (over 3 years ago)
- Last Synced: 2025-01-23T12:15:39.563Z (over 1 year ago)
- Language: Go
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-timeago
[](https://pkg.go.dev/github.com/mrinjamul/go-timeago)
[](https://goreportcard.com/report/github.com/mrinjamul/go-timeago)
[]()
[](https://github.com/mrinjamul/go-timeago/blob/main/LICENSE)
## What is this?
A go module to calculate the time difference between two dates and return the value in words.
No third-party library used.
## How to use this module?
To use this module,
```sh
go get github.com/mrinjamul/go-timeago
```
and then,
```go
import (
...
"github.com/mrinjamul/go-timeago"
)
```
### Examples
```go
package main
import (
"fmt"
"log"
"time"
"github.com/mrinjamul/go-timeago"
)
func main() {
time := time.Date(2021, 0, 0, 0, 0, 0, 0, time.Local)
msg, err := timeago.FormatNow(time)
if err != nil {
log.Fatalln(err)
}
fmt.Println(msg)
}
```
Output:
4 months ago
## License
This go module is licensed under BSD 3-Clause Copyright © 2021 Injamul Mohammad Mollah
## Thanks
This go package is inspired by [mrasif/timeago](https://github.com/mrasif/timeago) written in Java.