cloudscribe/cloudscribe.SimpleContent

Publishing pages in NoDB using the Markdown editor leaves them in Draft state

Closed this issue · 2 comments

Add-on to previous bug #512

When you use NoDb to publish cs pages using the Markdown editor, then the result is stored as a YAML file.
The YAMLDotNet serializer correctly serialises the PubDate as Utc.Now, so this sits as a string in the YAML file.
pubDate: 2021-09-27T16:59:41.4223202Z

Trouble is, the symmetrical YAMLDotNet deserializer then seems to read that back and convert it to local time.
So (in UK summer time) I get a page that is not published until 1 hour in the future.
If I wait one hour - all works fine, and the page is treated as published (because its PubDate is regarded as in the past).
You would never notice this bug in the UK winter time.

I'm struggling to fix this one, because I'm not seeing any clear config documentation to tell Yaml how to treat datetime fields.
https://github.com/aaubry/YamlDotNet/wiki/Serialization.Deserializer
Nor any previous discussion of why a DateTime field is not surviving a simple (and should-be-symmetrical) round-trip.

I can use cs's own built-in datetime utils to manually convert the retrieved PubDate value back from local to UTC, but the problem with that is that cs's definition of 'local' for those utils will come from its own site settings, whereas the YAML deserializer offset seems to be coming from my local machine - so the two might not necessarily match up - this could make matters worse.

This needs some digging into the YamlDotNet library.

Fixed by upgrade to YamlDotNet library 11.2.1

cloudscribe.SimpleContent.Storage.NoDb 5.1.4

Note: this is how you swap into markdown editing mode:
https://www.cloudscribe.com/using-markdown