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

Comments

@themihai
Copy link

@themihai themihai commented Aug 10, 2016

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

@bradfitz bradfitz commented Aug 10, 2016

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 label Oct 10, 2016
@gopherbot gopherbot closed this in fc88a0f Oct 24, 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.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.