reltime

package module
Version: v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 27, 2019 License: BSD-2-Clause Imports: 3 Imported by: 0

README

reltime

Package reltime implements a "time ago" algorithm.

import (
	"code.soquee.net/reltime"
)

License

The package may be used under the terms of the BSD 2-Clause License a copy of which may be found in the LICENSE file.

Unless you explicitly state otherwise, any contribution submitted for inclusion in the work by you shall be licensed as above, without any additional terms or conditions.

Documentation

Overview

Package reltime implements a "time ago" algorithm.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ago

func Ago(d time.Duration) string

Ago transforms durations into human readable strings.

Example
s := Ago(-24 * time.Hour)
fmt.Println(s)
Output:

about a day ago

func TimeAgo

func TimeAgo(t time.Time) string

TimeAgo transforms the difference between a time and the current time into a human readable string.

It is a convenience wrapper for Ago(time.Until(t)). For more information see the example on Ago.

Types

This section is empty.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto