humanize

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreationDate

func CreationDate(t time.Time) string

CreationDate returns the `time.Time`'s date formatted in the `02 Jan 2006` format Example output: 02 Dec 2016

func CreationDateRFC3339

func CreationDateRFC3339(str string) string

CreationDateRFC3339 parses the incoming string as an RFC3339-formatted date and then formats it into the `02 Jan 2006` format If the given string is not a valid RFC3339-formatted date, we will return an empty string Example output: 02 Dec 2016 See more: `CreationDate`

func CreationDateTime

func CreationDateTime(t time.Time) string

CreationDateTime returns the `time.Time`'s date formatted in the `02 Jan 2006 • 15:04 UTC` format Example output: 02 Jan 2006 • 15:04 UTC

func CreationDateTimeUnix

func CreationDateTimeUnix(unix int64) string

CreationDateTimeUnix parses the incoming `int64` as a unix timestamp and then formats it with the CreationDateTime function Example output: 02 Jan 2006 • 15:04 UTC

func CreationDateUnix

func CreationDateUnix(unix int64) string

CreationDateUnix parses the incoming int64 as a unix timestamp and then returns the date in the `CreationDate` format. Example output: 02 Dec 2016 See more: `CreationDate`

func Description

func Description(description string) string

Description formats the input description into a consistent format. Current operations is just limiting the string to 200 characters

func Duration

func Duration(duration time.Duration) string

Duration takes a `time.Duration` and converts it to the nearest-second string output Example output: 01:59:59

func DurationPT

func DurationPT(pt string) string

DurationPT takes a PT-formatted string `time.Duration` and converts it to the nearest-second string output using the `Duration` helper Example output: 01:59:59 See also: Duration

func DurationSeconds

func DurationSeconds(duration time.Duration) string

DurationSeconds takes a `time.Duration` and converts it to a string in the following format: %gs where %g is the number of seconds contained within this duration Example output: 53s

func Number

func Number(number uint64) string

func ShortDescription

func ShortDescription(description string) string

ShortDescription formats the input description as a short description. Example uses is the `description` key from the Wikipedia page summary API, where the summary for Forsen is "Swedish esports player and Twitch streamer" Current operations is just limiting the string to 60 characters

func Title

func Title(title string) string

Title formats the input title into a consistent format. Current operations is just limiting the string to 60 characters

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL