front-matter
front-matter copied to clipboard
Frontmatter date parsing oddities
Greetings, I have a markdown file that has a date frontmatter field that expects the date in YYYY-MM-DD format. When I read the data out using front-matter (for instance, using the date '2021-04-01'), I get the date with a bunch of other crap in there. It seems to be actually parsing the date and adjusting for timezone, so in the previous instance I get 'Wed Mar 31 2021 19:00:00 GMT-0500 (Central Daylight Time)'. Is there a way to tell it not to try and infer the type without changing the format (which I can't do without breaking a lot of other stuff)? I really just need the raw text value.
Same happened to me. I investigated and the problem appears to be that front-matter
uses js-yaml
with the default DEFAULT_SCHEMA
which includes automatic detection of dates. It would be better to use CORE_SCHEMA
or to pass through a schema
option to js-yaml
.
I’m having the same issue.
Is there a way to set the js-yaml CORE_SCHEMA?
I opened a related issue on the js-yaml repo , posting here in case it’s useful to others that run into something similar.