format

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidFormatForTypeYearMonth = errors.New("invalid format: expecting type#year-month")
	ErrInvalidEmailType              = errors.New("invalid email type: expecting inbox or sent")
	ErrInvalidEmailYear              = errors.New("invalid email year: expecting 4 digit integer string")
	ErrInvalidEmailMonth             = errors.New("invalid email type: expecting 2 digit integer string")
)

Errors

Functions

func Date added in v1.10.0

func Date(date string) string

Date formats Date from SMTP headers to RFC3399, as it's used by DynamoDB.

TODO: date from Gmail produce an error

func DateTime added in v1.10.0

func DateTime(t time.Time) string

DateTime converts time.Time to dd-hh:mm:ss

func ExtractTypeYearMonth

func ExtractTypeYearMonth(s string) (emailType string, yearMonth string, err error)

ExtractTypeYearMonth parses type-year-month string and returns EmailType and year-month

func RFC3399 added in v1.10.0

func RFC3399(t time.Time) string

RFC3399 formats time in RFC3399

func RejoinDate

func RejoinDate(ym string, dt string) string

RejoinDate converts year-month and date-time to RFC3399

func TypeYearMonth added in v1.10.0

func TypeYearMonth(emailType string, t time.Time) (string, error)

TypeYearMonth formats time.Time to type#YYYY-MM

Types

This section is empty.

Jump to

Keyboard shortcuts

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