Skip to content

Commit fbf3487

Browse files
forkialfonsogarciacaro
authored andcommitted
Show that working with DateTimeOffset doesn't work
1 parent e3af6cf commit fbf3487

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/Main/DateTimeTests.fs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,23 @@ let ``DateTime.ToLocalTime works``() =
102102
d.Kind <> d'.Kind
103103
|> equal true
104104

105+
[<Test>]
106+
let ``Creating DateTimeOffset from DateTime and back works``() =
107+
let d = DateTime(2014, 10, 9, 13, 23, 30, DateTimeKind.Utc)
108+
let dto = DateTimeOffset(d)
109+
let d' = dto.DateTime
110+
111+
d' |> equal d
112+
113+
114+
[<Test>]
115+
let ``Formatting DateTimeOffset works``() =
116+
let d = DateTime(2014, 10, 9, 13, 23, 30, DateTimeKind.Utc)
117+
let dto = DateTimeOffset(d)
118+
119+
dto.ToString() |> equal "09.10.2014 13:23:30 +00:00"
120+
dto.ToString("HH:mm:ss") |> equal "13:23:30"
121+
105122
[<Test>]
106123
let ``DateTime.Hour works``() =
107124
let d = DateTime(2014, 10, 9, 13, 23, 30, DateTimeKind.Local)

0 commit comments

Comments
 (0)