allow golangs wierd m=+0.00000 offset closes #57

This commit is contained in:
Aaron Raddon
2018-04-17 14:16:01 -07:00
parent b8014f0dba
commit b0e7f69efa
2 changed files with 40 additions and 12 deletions

View File

@@ -126,8 +126,10 @@ func TestInLocation(t *testing.T) {
func TestOne(t *testing.T) {
time.Local = time.UTC
var ts time.Time
ts = MustParse("2018-04-02T22:18+0000")
assert.Equal(t, "2018-04-02 22:18:00 +0000 UTC", fmt.Sprintf("%v", ts.In(time.UTC)))
// {in: "2015-02-08 03:02:00 +0300 MSK m=+0.000000001", out: "2015-02-08 00:02:00 +0000 UTC"},
// {in: "2015-02-08 03:02:00.001 +0300 MSK m=+0.000000001", out: "2015-02-08 00:02:00.001 +0000 UTC"},
ts = MustParse("2015-02-08 03:02:00.001 +0300 MSK m=+0.000000001")
assert.Equal(t, "2015-02-08 00:02:00.001 +0000 UTC", fmt.Sprintf("%v", ts.In(time.UTC)))
}
type dateTest struct {
@@ -347,6 +349,9 @@ var testInputs = []dateTest{
{in: "2014-04-26 17:24:37.123456 +0000 UTC", out: "2014-04-26 17:24:37.123456 +0000 UTC"},
{in: "2014-04-26 17:24:37.12 +0000 UTC", out: "2014-04-26 17:24:37.12 +0000 UTC"},
{in: "2014-04-26 17:24:37.1 +0000 UTC", out: "2014-04-26 17:24:37.1 +0000 UTC"},
{in: "2015-02-08 03:02:00 +0200 CEST m=+0.000000001", out: "2015-02-08 01:02:00 +0000 UTC", loc: "Europe/Berlin"},
{in: "2015-02-08 03:02:00 +0300 MSK m=+0.000000001", out: "2015-02-08 00:02:00 +0000 UTC"},
{in: "2015-02-08 03:02:00.001 +0300 MSK m=+0.000000001", out: "2015-02-08 00:02:00.001 +0000 UTC"},
// yyyy-mm-dd hh:mm:ss TZ
{in: "2012-08-03 18:31:59 UTC", out: "2012-08-03 18:31:59 +0000 UTC"},
{in: "2014-12-16 06:20:00 GMT", out: "2014-12-16 06:20:00 +0000 UTC"},