Skip to content

Commit

Permalink
Make parse<DateTime> return a UTC DateTime
Browse files Browse the repository at this point in the history
Otherwise it will depend on the local machine, you can always convert it to Local afterwards if desired.
  • Loading branch information
gusty committed Oct 14, 2023
1 parent 21f4a0b commit 466d3e1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/FSharpPlus/Control/Converter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ type Parse =
static member Parse (_: DateTime , _: Parse) = fun (x:string) ->
match DateTime.TryParseExact (x, [|"yyyy-MM-ddTHH:mm:ss.fffZ"; "yyyy-MM-ddTHH:mm:ssZ"|], null, DateTimeStyles.RoundtripKind) with
| true, x -> x
| _ -> DateTime.Parse (x, CultureInfo.InvariantCulture)
| _ -> DateTime.Parse (x, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal)

static member Parse (_: DateTimeOffset, _: Parse) = fun (x:string) ->
try DateTimeOffset.ParseExact (x, [|"yyyy-MM-ddTHH:mm:ss.fffK"; "yyyy-MM-ddTHH:mm:ssK"|], null, DateTimeStyles.AssumeUniversal)
Expand Down

0 comments on commit 466d3e1

Please sign in to comment.