Still, this is the only issue I have with the time library, and even that has only bothered me a couple of times in 3 years of work, so no biggie. Other than that it's indeed the best time library I've ever worked with.
> formats := []string{ string(time.RFC3339), "2006-01-02T15:04:05.0", "2006-01-02T15:04:05.00", "2006-01-02T15:04:05", "2006-01-02T15:04",}
To make sure I have all cases covered
I can totally understand that it is often easier to use, but compatibility with strftime is good for the experienced developer. There is a reason, why sites like [1] and several 3rd party libs [2] exist.
[1]: http://fuckinggodateformat.com/
[2]: https://github.com/search?q=language%3Ago+strftime&ref=searc...
Because it seems that golang does not recognize the abbreviations at all.
I can only assume that the time zone name alone is insufficient to resolve ambiguous times.
Unless there is a way to get "America/Los_Angeles" from "PST"
On the other hand, -0700 isn't much longer than PST and parses directly.
Offsets aren't always the right thing to use either. If you are in America/Chicago and use -0600 for your timezone, that's only accurate during standard time, and is off by an hour for daylight savings time. Knowing how/when to shift offsets is part of the timezone rules associated with a locale, because they are not constant historically.
Offsets are probably going to be fine for recorded timestamps, if all you need is the absolute time that the timestamp represents. But yeah, timezones make things so complicated that there is no one true solution I guess.