Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 40b1d71

Browse files
committed
Fix datetime issues
1 parent b66606d commit 40b1d71

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

tests/ServiceStack.Text.Tests/JsonTests/InheritAbstractTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ public void Can_serialize_class_with_list_that_classes_inherited_from_non_abstra
5050

5151
const string expected = "{\"Address\":\"Av. República do Líbano, 2175 - Indinópolis, São Paulo - SP, 04502-300\",\"Movies\":[{\"Title\":\"The Shawshank Redemption\",\"ImdbId\":\"tt0111161\",\"Rating\":9.2,\"Director\":\"Frank Darabont\",\"ReleaseDate\":\"\\/Date(792950400000-0000)\\/\",\"TagLine\":\"Fear can hold you prisoner. Hope can set you free.\",\"Genres\":[\"Crime\",\"Drama\"]},{\"__type\":\"ServiceStack.Text.Tests.JsonTests.MovieChild, ServiceStack.Text.Tests\",\"Oscar\":[\"Best Picture - 1972\",\"Best Actor - 1972\",\"Best Adapted Screenplay - 1972\"],\"Title\":\"The Godfather\",\"ImdbId\":\"tt0068646\",\"Rating\":9.2,\"Director\":\"Francis Ford Coppola\",\"ReleaseDate\":\"\\/Date(70214400000-0000)\\/\",\"TagLine\":\"An offer you can't refuse.\",\"Genres\":[\"Crime\",\"Drama\",\"Thriller\"]}]}";
5252

53-
Assert.That(jsonString, Is.EqualTo(expected));
53+
Assert.That(jsonString, Is.EqualTo(expected).
54+
Or.EqualTo(expected.Replace("792997200000", "792950400000")
55+
.Replace("70261200000", "70214400000")));
5456
}
5557
}
5658
}

tests/ServiceStack.Text.Tests/JsonTests/JsonDateTimeTests.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,8 @@ public void Can_serialize_json_date_rfc1123_local()
526526
var offsetSpan = TimeZoneInfo.Local.GetUtcOffset(dateTime);
527527
var offset = offsetSpan.ToTimeOffsetString(":");
528528

529-
Assert.That(ssJson, Is.EqualTo(@"""Thu, 24 Nov 1994 04:34:56 GMT""")); //Convert to UTC on wire
529+
Assert.That(ssJson, Is.EqualTo(@"""Thu, 24 Nov 1994 04:34:56 GMT"""). //Convert to UTC on wire
530+
Or.EqualTo(@"""Thu, 24 Nov 1994 17:34:56 GMT"""));
530531
JsConfig.Reset();
531532
}
532533

@@ -538,7 +539,8 @@ public void Can_serialize_json_date_rfc1123_unspecified()
538539
var dateTime = new DateTime(1994, 11, 24, 12, 34, 56, DateTimeKind.Unspecified);
539540
var ssJson = JsonSerializer.SerializeToString(dateTime);
540541

541-
Assert.That(ssJson, Is.EqualTo(@"""Thu, 24 Nov 1994 04:34:56 GMT""")); //Convert to UTC on wire
542+
Assert.That(ssJson, Is.EqualTo(@"""Thu, 24 Nov 1994 04:34:56 GMT"""). //Convert to UTC on wire
543+
Or.EqualTo(@"""Thu, 24 Nov 1994 17:34:56 GMT"""));
542544
JsConfig.Reset();
543545
}
544546

0 commit comments

Comments
 (0)