Skip to content

time: ParseTime layouts with underscores _ #21966

@FlorianUekermann

Description

@FlorianUekermann

I suspect this has been mentioned before, but my searches came up empty.

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

This fmt.Println(time.Parse("2006-_1-_2", "2017-7-17")) fails with this 0001-01-01 00:00:00 +0000 UTC parsing time "2017-7-17" as "2006-_1-_2": cannot parse "7-17" as "-_" output.

I naively expected _-parsing to be less greedy. I'm not sure if this is supposed to work, but maybe it is worth fixing anyway.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions