apognu/gocal

Incorrect timezone capitalization

Closed this issue · 2 comments

In parser/time.go, line 36, LoadLocation is passed the result of strings.Title(strings.ToLower()). This produces an error on Linux, where the name parameter is case sensitive (it seems to work on Macs, however). If you take the timezone "America/Los_Angeles" and run it through ToLower/Title, you end up with "America/Los_angeles", which causes LoadLocation to fail. I don't know if any processing needs to be done on the input parameter (can we assume that the capitalization will be correct on input?). If we do need to process it, then a replacement for strings.Title() should be used that also capitalizes letters after underscores.

Nice catch!

In 8a8c0d8, exact case matches take priority on timezone selection.

We only try and mangle the input match if there is none. I prefer and keep this fallback as a lot of ICS files I deal with have a hard time following standards.

We've seen lots of different timezone names. We modified the code to use this lookup map we created, and it's helped a lot (you're welcome to use if you wish): zonemap.go