Date format in flex-objects doesn't seem to work?

Hey there,

I am creating a calendar thingy which is expected to contain some 200 elements at any given time (events for the next six months). To make the handling easier I wanted to do this with flex-objects and not a custom page template, because in pages the list of sibling events in the Advanced tab would be extremely long.

However – I of course want to be able to sort these entries by date, and that would require me to have one associated field with the date as a “YYYY-MM-DD” string, since flex-objects don’t sort properly by date at least in Admin (the way I understand it).

So what I’ve done is, in termine.yaml (flex-objects definition file):

    # List view
    list:
      title: name
      order:
        by: datum
        dir: asc
      fields:
        published:
          field:
            type: toggle
            label: Publ
          width: 8
        titel:
          link: edit
        datum:
          format: 'Y-m-d'

This seems to do nothing. The format stays “m/d/Y” and the list doesn’t get sorted by that either. What am I doing wrong?

I’m still puzzled by this. In the JSON file the date format actually IS “Y-m-d”. Why does Grav Admin show it differently?

If I click the header to sort, the entries do get sorted, but as strings by the format “m/d/Y” which will be problematic during the winter months…

Any ideas are much appreciated!

Found the answer, I was doing it wrong! This works (again in the flex blueprint):

config:
    data:
        ordering:
            datum: ASC

RTFM… properly :sweat_smile: