protodate

package
v0.0.0-...-c5da4db Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2017 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// SystemDater is a Dater that uses the system UTC time.
	SystemDater = &systemDater{}
)

Functions

func DateEqual

func DateEqual(i *google_type.Date, j *google_type.Date) bool

DateEqual returns true if i equals j.

func DateInRange

func DateInRange(d *google_type.Date, start *google_type.Date, end *google_type.Date) bool

DateInRange returns whether d is within start to end, inclusive. The given date is expected to not be nil. If start is nil, it checks whether d is less than or equal to end. If end is nil it checks whether d is greater than or equal to end. If start and end are nil, it returns true.

func DateLess

func DateLess(i *google_type.Date, j *google_type.Date) bool

DateLess returns true if i is before j.

func DateToTime

func DateToTime(d *google_type.Date) time.Time

DateToTime converts a Date to a golang Time.

func NewDate

func NewDate(month int32, day int32, year int32) *google_type.Date

NewDate is a convienence function to create a new Date.

func Now

func Now() *google_type.Date

Now returns the current date at UTC.

func TimeToDate

func TimeToDate(t time.Time) *google_type.Date

TimeToDate converts a golang Time to a Date.

Types

type Dater

type Dater interface {
	Now() *google_type.Date
}

Dater provides the current date.

type FakeDater

type FakeDater interface {
	Dater
	Set(month int32, day int32, year int32)
}

FakeDater is a Dater for testing.

func NewFakeDater

func NewFakeDater(month int32, day int32, year int32) FakeDater

NewFakeDater returns a new FakeDater with the initial date.

Jump to

Keyboard shortcuts

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