date

package
v0.0.0-...-6a53fb6 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2021 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrExpectedJson = errors.New("unexpected type date.Date in json format")

Functions

This section is empty.

Types

type Date

type Date struct {
	// safe between 0 to 32767
	// but should be 1000 to 9999
	Year uint16 `json:"year"`
	// safe between 0 to 255
	// but should be 0 to 12
	Month uint8 `json:"month"`
	// safe between 0 to 255
	// but should be 0 to 31
	Day uint8 `json:"day"`
}

func New

func New(c int32) *Date

New decodes the int32 type to a date.

func Now

func Now() *Date

Now returns a current Date struct.

func (*Date) After

func (d *Date) After(u *Date) bool

func (*Date) Before

func (d *Date) Before(u *Date) bool

func (*Date) Compare

func (d *Date) Compare(u *Date) int

func (*Date) Encode

func (d *Date) Encode() int32

Encode encodes the date to an int32 type

func (*Date) Equal

func (d *Date) Equal(u *Date) bool

func (*Date) MarshalJSON

func (d *Date) MarshalJSON() ([]byte, error)

func (*Date) UnmarshalJSON

func (d *Date) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

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