choptastic/qdate — pull request #5 by mrallen1 (2013-09-18 16:23:20+00:00)
Title: Support setting binary string timezones

I noticed that setting a timezone value to a binary string made bad things happen under the hood of qdate.

```
15> qdate:set_timezone(<<"America/New York">>).
(<0.52.0>) call qdate:set_timezone(<<"America/New York">>)
(<0.52.0>) returned from qdate:set_timezone/1 -> ok
ok
16> qdate:to_unixtime({{2013,9,18},{9,0,0}}).
(<0.52.0>) call qdate:to_unixtime({{2013,9,18},{9,0,0}})
(<0.52.0>) call qdate:to_date("GMT",{{2013,9,18},{9,0,0}})
(<0.52.0>) call qdate:extract_timezone({{2013,9,18},{9,0,0}})
(<0.52.0>) call qdate:determine_timezone()
(<0.52.0>) returned from qdate:determine_timezone/0 -> <<"America/New York">>
(<0.52.0>) returned from qdate:extract_timezone/1 -> {{{2013,9,18},{9,0,0}},
<<"America/New York">>}
(<0.52.0>) call qdate:try_registered_parsers({{2013,9,18},{9,0,0}})
(<0.52.0>) call qdate:try_parsers({{2013,9,18},{9,0,0}},[])
(<0.52.0>) returned from qdate:try_parsers/2 -> undefined
(<0.52.0>) returned from qdate:try_registered_parsers/1 -> undefined
(<0.52.0>) call qdate:raw_to_date({{2013,9,18},{9,0,0}})
(<0.52.0>) returned from qdate:raw_to_date/1 -> {{2013,9,18},{9,0,0}}
** exception error: no function clause matching
calendar:date_to_gregorian_days(error)
in function calendar:datetime_to_gregorian_seconds/1
in call from qdate:to_unixtime/1
(<0.52.0>) call qdate:date_tz_to_tz({{2013,9,18},{9,0,0}},<<"America/New York">>,"GMT")
(<0.52.0>) call qdate:ensure_timezone("GMT")
17> (<0.52.0>) returned from qdate:ensure_timezone/1 -> "GMT"
(<0.52.0>) returned from qdate:date_tz_to_tz/3 -> {error,unknown_tz}
(<0.52.0>) returned from qdate:to_date/2 -> {error,unknown_tz}
```

There are obviously a lot of different ways to fix this, but here is one.

All of the unit tests pass after this change.

Thanks.