Skip to content

time: doesn't parse RFC3339 properly #9346

@aniketawati

Description

@aniketawati

Time can't parse the layout constant for RFC3339 in the code itself.

For eg. Go playground link - http://play.golang.org/p/EJH53M__AH

    // Time value taken from go source https://github.com/golang/go/blob/master/src/time/format.go#L51
    layout := "2006-01-02T15:04:05Z07:00" // RFC3339
    tm, err := time.Parse(layout, layout) 
    if err != nil {
        fmt.Println("error", err)
        return
    }
    fmt.Println("Parsed time", tm)

Currently if there is any offset in time (non UTC time), time formats it in RFC3339 as - +07:00 instead of Z07:00

If Z07:00 is given, it gives an error

error parsing time "2006-01-02T15:04:05Z07:00": extra text: 07:00

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions