Documentation ¶
Overview ¶
Package types provides custom types for the application.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Date ¶
Date is a custom type that implements the MarshalJSON interface that applies date only formatting to the time.Time fields in order to avoid common time and timezone pitfalls when working with Times.
Examples:
"2019-01-01" -> time.Time{2019-01-01 00:00:00 +0000 UTC} "2019-01-01T21:10:30Z" -> time.Time{2019-01-01 00:00:00 +0000 UTC} "2019-01-01T21:10:30+01:00" -> time.Time{2019-01-01 00:00:00 +0000 UTC}
func DateFromString ¶
DateFromString returns a Date type from a string by parsing the string into a time.Time type and then stripping the time and timezone information.
Errors are ignored and an empty Date is returned.
func DateFromTime ¶
DateFromTime returns a Date type from a time.Time type by stripping the time and timezone information.
func (Date) MarshalJSON ¶
func (*Date) UnmarshalJSON ¶
Click to show internal directories.
Click to hide internal directories.