fjoppe / Legivel

F# Yaml 1.2 parser
https://fjoppe.github.io/Legivel
The Unlicense
60 stars 5 forks source link

Cannot parse to DateTimeOffset #27

Closed dbrattli closed 4 years ago

dbrattli commented 4 years ago

Description

Cannot parse to DateTimeOffset.

Repro steps

Please provide the steps required to reproduce the problem

let test = Deserialize<DateTimeOffset> "2019-12-29T11:43:30+01:00"
printfn "%A" test

This will output:

[Error
   { Warn = []
     Error =
            [{ Location = (l0, c0)
               Message =
                        "Unsupported: no conversion for: System.Reflection.MemberTypes.System.DateTimeOffset" }]
     StopLocation = (l0, c0)}]

Expected behavior

Expect that DateTimeOffset are parsed similar to DateTime, but that time zone information is preserved.

Actual behavior

Please provide a description of the actual behavior you observe.

Known workarounds

Not known. Can I register my own converter to mitigate?

Related information

fjoppe commented 4 years ago

Hi Dag,

Nice to hear from you, hope you are well.

This issue is solved in Legivel 0.4.3, which will be available via Nuget soon. This was an easy one as it only affected the serialization target. This is mapped from the yaml timestamp tag to DateTimeOfftset.

Regards!

dbrattli commented 4 years ago

Hi Frank, thanks for fixing so quickly! I'm using Legivel for a new Hugo inspired project together with Feliz.ViewEngine so there's a lot of Yaml config to parse. Will test it later today.

Regards!