when

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2023 License: MIT Imports: 2 Imported by: 3

README

when ?

The when utility takes input as any popular time format and generates a human-readable description of the provided time, indicating whether the time is in the past or future. It also provides a lightweight sense of approximation. This utility obviously enhances any application where timestamped data is frequently displayed to users.

Installation

go get github.com/ubhattac/when

Go Usage

import "github.com/ubhattac/when"
readableTime, err := when.When(input)

Reference cmd/when/main.go for more usage in Go.

CLI Usage

Simply, when [-v] <timestamp>

$ go install github.com/ubhattac/when/cmd/when@latest
$ when 2023-09-03T09:10:00Z
26m
$ when -v 2023-08-13T14:30:00Z
around 2 weeks ago
$ when -v 1443018600
over 7 years ago
$ when 2023-09-23T14:30:00Z
09/23/2015
$ when -v -v 1722733189
in roughly 11 months

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func When

func When(time string) (string, error)

func WhenVerbose

func WhenVerbose(time string) (string, error)

Types

This section is empty.

Directories

Path Synopsis
cmd
internal

Jump to

Keyboard shortcuts

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