Closed lolbat closed 1 year ago
This may be a YAML issue. What happens when you do the same roundtrip with PyYAML alone?
Let me write a test and get back to you
As you thought, it is the YAML library
{'title': 'Learning a new language', 'date': datetime.datetime(2023, 3, 29, 8, 58, 50, tzinfo=datetime.timezone(datetime.timedelta(days=-1, seconds=64800))), 'draft': False, 'tags': ['Python', 'Hugo']}
It also converts all of the truthy text to booleans as well.
I am writing a short utility to check the values of some of the keys in posts I am writing for the Hugo ssg.
Each post has a date key with the date value stored as an RFC3339 format date
date: 2022-12-06T09:05:28-06:00
When I read the
date
key in the code appears to be converting it to a datetime object2022-12-06 09:05:28-06:00
and when that gets converted back into a string the date isn't in the correct format.
Would it be possible to add a load option that didn't convert the dates? I have hacked a fix together to recreate the proper date but it would be nice to have them left as strings.