Is there a way to stop frontmatter yaml being sanitized?

I want the dates I put in yaml to stay human readable, but the the frontmatter gets re-written on save, and dates get converted to timestamps.

Also, sometimes I just prefer my own formatting. There has to be a way to do this right?

Timestamp is the right way. Then you can convert and format it to whatever you want on output. Timestamp is always UTC and if you save date as a string, there’s no way to actually tell what time it is.

@PatienceAllergy, When entering a date using Admin for the ‘date’ variable on the Options tab of a page, the selected date is being saved as:

title: Typography
date: '16-08-2021 13:59'

This seems quite readable to me…

If you would like another dateformat, you can choose one in the configuration panel for System. E.g dateformat.default: 'Y-m-d H:i' yields:

title: Typography
date: '2021-08-13 14:13'

The blueprint of the Date field is:
  type: datetime
  toggleable: true

If this is not acceptable in your use-case, then please elaborate and share what you are doing and what you expect.

Yes, it is quite readable. There is nothing wrong with it. But I want to be able to input a date without quotes.

This might seem like a small issue, but it’s part of a bigger issue where formatting like this:

html: >-
        blah di blah di blah

is completely understood by GRAV, but then written back UGLY like this:

html: "<p>\n    blah di blah di blah\n</p>\n"

If it was just me that had to see it, that might be okay, but I’m trying to set something up that’s simple, well laid out, and easy to read and change by a client.

So, I’d like to be able to use YAML in all the ways I tell it too without GRAV making it ugly. Is there a way to do this?

Perhaps that is something that can be set with the blueprint file you mentioned? I’m unfamiliar with what can be achieved with those.

Thanks for your thoughtful reply! :grinning:

You’re right, timestamps are great and versatile in a number of applications where computers need to be able to read it.

But my client (a human) needs to be able to scroll through the YAML, and understand the dates they are looking at easily. For that matter, so do I.

Also, a timestamp is not needed with the twig date() function (which is how it is being used). Just like the PHP counterpart, date() understands various string formats.