diff --git a/localtime.go b/localtime.go index 5a91bd6..30a31dc 100644 --- a/localtime.go +++ b/localtime.go @@ -97,7 +97,7 @@ func (d LocalDateTime) AsTime(zone *time.Location) time.Time { // String returns RFC 3339 representation of d. func (d LocalDateTime) String() string { - return d.LocalDate.String() + " " + d.LocalTime.String() + return d.LocalDate.String() + "T" + d.LocalTime.String() } // MarshalText returns RFC 3339 representation of d. diff --git a/localtime_test.go b/localtime_test.go index d972e5d..d8e255e 100644 --- a/localtime_test.go +++ b/localtime_test.go @@ -88,7 +88,7 @@ func TestLocalDateTime_String(t *testing.T) { toml.LocalDate{2021, 6, 8}, toml.LocalTime{20, 12, 1, 2, 9}, } - require.Equal(t, "2021-06-08 20:12:01.000000002", d.String()) + require.Equal(t, "2021-06-08T20:12:01.000000002", d.String()) } func TestLocalDateTime_MarshalText(t *testing.T) { @@ -98,7 +98,7 @@ func TestLocalDateTime_MarshalText(t *testing.T) { } b, err := d.MarshalText() require.NoError(t, err) - require.Equal(t, []byte("2021-06-08 20:12:01.000000002"), b) + require.Equal(t, []byte("2021-06-08T20:12:01.000000002"), b) } func TestLocalDateTime_UnmarshalMarshalText(t *testing.T) { diff --git a/toml_testgen_test.go b/toml_testgen_test.go index d6ebdee..d4bf4da 100644 --- a/toml_testgen_test.go +++ b/toml_testgen_test.go @@ -1107,7 +1107,6 @@ func TestTOMLTest_Valid_Datetime_LocalTime(t *testing.T) { } func TestTOMLTest_Valid_Datetime_Local(t *testing.T) { - t.Skip("FIXME") input := "local = 1987-07-05T17:45:00\nmilli = 1977-12-21T10:32:00.555\nspace = 1987-07-05 17:45:00\n" jsonRef := "{\n \"local\": {\n \"type\": \"datetime-local\",\n \"value\": \"1987-07-05T17:45:00\"\n },\n \"milli\": {\n \"type\": \"datetime-local\",\n \"value\": \"1977-12-21T10:32:00.555\"\n },\n \"space\": {\n \"type\": \"datetime-local\",\n \"value\": \"1987-07-05T17:45:00\"\n }\n}\n" testgenValid(t, input, jsonRef)