Commit Graph

15 Commits

Author SHA1 Message Date
Bjørn Erik Pedersen f31dc0aaab
Adjust timezone logic
This commit adjusts the previous commit re. the new `ToTimeInDefaultLocationE` and related functions.

The functional change is that we don't default to any location if not provided from the caller.
This is in line with how `ToTime` worked before we started this, and even if the default behaviour may look weird in some cases, it will not break anything.

Most applications will want to use the new *InDefaultLocation functions and decide which default location to use:

```go
loc := time.Local
if config.Location != "" {
    loc = time.LoadLocation(config.Location)
}

t, err := StringToDateInDefaultLocation("2019-01-01", loc)

```

This commit also configure Travis to test on OSX and Windows in addition to Linux.
2019-05-31 17:19:31 +02:00
Heewa Barfchin b1aa5f0c52
Add ToTimeInDefaultLocation/E
Go's time parsing uses UTC when the format doesn't have a tiemzone, and
has even weirder behavior when it has a zone name but no numeric offset.
A caller to `cast.ToTime` won't know if the returned time was explicitly
in UTC, or defaulted there, so the caller cannot fix it. These new
functions allow a user to supply a different timezone to default to,
with nil using the local zone.
2019-05-31 11:32:53 +02:00
Theofanis Despoudis 4dd38b8b57 Add support for map of int64 and map of int 2018-10-24 20:00:14 +02:00
Roman Volosatovs acbeb36b90 Add ToDurationSlice() 2017-04-13 11:15:03 +02:00
Cameron Moore d37435d953 Add additional type conversions
Adds float32, uint, uint64, uint32, uint16, and uint8 throughout.

Fixes #33
2017-03-03 22:17:07 +01:00
Cameron Moore 2c719d95d6 Fix gofmt and golint errors 2017-03-03 16:44:53 +01:00
chyeh e4f8127058 Add `ToInt8`, `ToInt16` and `ToInt32` 2017-03-03 15:54:08 +01:00
M@ 60e7a69a42 Add ToBoolSlice()
Fixes #1
2016-09-19 22:26:41 +02:00
Matt Keller 0eed3d1b35 Add a ToInt64() and necessary plumbing 2016-03-14 20:19:19 +01:00
jackspirou 7ed57e5c41 adding ToStringMapStringSlice method 2015-08-03 12:36:12 -04:00
bep 2c4fdb5416 Add ToIntSlice 2015-02-24 12:08:11 -05:00
Chance Zibolski 3cc9db95ac Add ToDuration 2015-02-24 12:07:25 -05:00
bep bbe2d4b35d Add ToStringMapBool
ToStringMapBool is useful for a map of flags in a configuration file.
2014-11-06 11:32:02 +01:00
spf13 99f1223ff6 Adding ToSlice 2014-04-26 16:56:25 -06:00
spf13 6796452c69 initial commit of library & tests 2014-04-05 01:21:52 -04:00