Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net/mail: export parseDate? #16657

Closed
themihai opened this issue Aug 10, 2016 · 1 comment
Closed

net/mail: export parseDate? #16657

themihai opened this issue Aug 10, 2016 · 1 comment
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@themihai
Copy link

RFC5322 has resent fields. Therefore we need a key param on (Header).Date() method so that we can parse the "Resent-Date" header. I see 3 possible options:

// key is optional for backwards compatibility. If it's not set it parses "Date"
func (h Header) Date(key ...string) (time.Time, error)

// Parses "Resent-Date" header.
func (h Header) DateReset() (time.Time, error)

// Parse a date-time format as specified in rfc5322

func ParseDate(s string)(time.Time, error)
@bradfitz
Copy link
Contributor

We can't change Header.Date.

Exposing "func ParseDate" seems fine. Of course, the workaround is pretty easy too:

https://play.golang.org/p/SvuD6Mahsb

func main() {
    h := mail.Header{"Resent-Date": {"Wed, 10 Aug 2016 02:37:48 -0700"}}

    fmt.Println(mail.Header{"Date": {h.Get("Resent-Date")}}.Date())
}

@bradfitz bradfitz added this to the Go1.8Maybe milestone Aug 10, 2016
@bradfitz bradfitz changed the title net/mail: (Header).Date() should support a key net/mail: export parseDate? Aug 10, 2016
@quentinmit quentinmit added the NeedsFix The path to resolution is known, but the work has not been done. label Oct 10, 2016
@golang golang locked and limited conversation to collaborators Oct 24, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants