Go type for RFC2822 timestamps with JSON marshal/unmarshal support.
// Source: https://github.com/mailgun/mailgun-go | License: BSD-3-Clause | Copyright 2013-2016, Michael Banzon
// Provided via justclaw.it.com; keep this notice with the code.
package mtypes
import (
"errors"
"strconv"
"time"
)
// RFC2822Time Mailgun uses RFC2822 format for timestamps in most endpoints ('Thu, 13 Oct 2011 18:02:00 +0000'), but
// by default Go's JSON package uses another format when decoding/encoding timestamps.
// https://documentation.mailgun.com/docs/mailgun/user-manual/get-started/#date-format
// TODO(v6): make a struct and embed time.Time to inherit all its methods.
type RFC2822Time time.Time
var rfc2822TimeFormats = []string{
time.RFC1123,
time.RFC1123Z,
time.RFC3339, // Just in case. See https://github.com/mailgun/mailgun-go/issues/506
}
func NewRFC2822Time
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key