Documentation ¶
Overview ¶
Package date adds date-based helper functions for templating
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Register ¶
func Register(args plugins.RegistrationArguments) error
Register provides the plugins.RegisterFunc
Types ¶
type Interval ¶
Interval represents a human-minded diff of two dates which is in no way interchangeable with a time.Duration: The DateInterval takes each date component and subtracts them. This causes the 03/25 to be exactly one month distant from 02/25 even though the distance would be different than with 03/25 and 04/25 which is also exactly one month.
func NewInterval ¶
NewInterval creates an Interval from two given dates
func (Interval) Format ¶
Format takes a template string analog to a strftime string and formats the Interval accordingly:
%Y / %y = Years with / without leading digit to 2 places %M / %m = Months with / without leading digit to 2 places %D / %d = Days with / without leading digit to 2 places %H / %h = Hours with / without leading digit to 2 places %I / %i = Minutes with / without leading digit to 2 places %S / %s = Seconds with / without leading digit to 2 places