lwtime

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

A simple relative and natural time package

A simple relative and natural time package

Index

Constants

View Source
const (
	Today     naturalAdjective = "today"
	Yesterday naturalAdjective = "yesterday"
	This      naturalAdjective = "this"
	Current   naturalAdjective = "current"
	Previous  naturalAdjective = "previous"
	Last      naturalAdjective = "last"
)
View Source
const (
	Year   relativeUnit = "y"
	Month  relativeUnit = "mon"
	Week   relativeUnit = "w"
	Day    relativeUnit = "d"
	Hour   relativeUnit = "h"
	Minute relativeUnit = "m"
	Second relativeUnit = "s"
)

Variables

This section is empty.

Functions

func ParseNatural

func ParseNatural(n string) (time.Time, time.Time, error)

Parse the string representation of a Lacework natural time

start, end, err := lwtime.ParseNatural("this year")

if err != nil {
	...
}

func ParseRelative

func ParseRelative(s string) (time.Time, error)

Parse the string representation of a Lacework relative time

t, err := lwtime.ParseRelative("-1y@y")

if err != nil {
	...
}

Types

This section is empty.

Jump to

Keyboard shortcuts

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