period

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2020 License: MIT Imports: 1 Imported by: 1

Documentation

Overview

Package period contains extensions for time.Duration to represent days and months.

Index

Constants

View Source
const (
	// Day represents the amount of time in a single day.
	Day = Period(time.Hour * 24)
	// Week represents the amount of time in a single week.
	Week = Day * 7
	// Month represents the amount of time in 30 days.
	Month = Day * 30
	// Year represents the amount of time in a year.
	Year = Day * 365
)

nolint: gomnd

Variables

This section is empty.

Functions

This section is empty.

Types

type Period

type Period time.Duration

The Period type represents larger time.Duration constants than those provided in the standard library.

func Parse

func Parse(str string) (Period, bool)

Parse the given string as a Period. Returns false if the string does not match a period value.

func (Period) Duration

func (p Period) Duration() time.Duration

Duration returns the Period as a time.Duration.

func (Period) String

func (p Period) String() string

Jump to

Keyboard shortcuts

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