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

Commit 5cc565f

Browse files
committed
fixed invalid test to support different time zones
1 parent eba6ee2 commit 5cc565f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,10 @@ public void Can_serialize_json_date_timestampOffset_unspecified()
7272
var dateTime1 = new DateTime(1994, 11, 24, 0, 0, 0, DateTimeKind.Unspecified);
7373
var ssJson1 = JsonSerializer.SerializeToString(dateTime1);
7474

75-
Assert.That(ssJson1, Is.EqualTo(@"""\/Date(785653200000-0000)\/"""));
75+
var offsetSpan = TimeZoneInfo.Local.GetUtcOffset(dateTime1);
76+
var ticks = 785635200000 - offsetSpan.TotalMilliseconds;
77+
78+
Assert.That(ssJson1, Is.EqualTo(@"""\/Date(" + ticks + @"-0000)\/"""));
7679
JsConfig.Reset();
7780
}
7881

0 commit comments

Comments
 (0)