Can't list page collection in date order

I want to list a collection by date. I believe I have followed the docs http://learn.getgrav.org/content/collections but the output is not ordered by date.

I have set up:

content:
    items: '@self.children'
    order:
        by: date
        dir: asc

Instances look like this:

title: Pride and Prejudice
author: Jane Austen
date: 1813

The template lists the items in the page collection in the usual way:

{% for child in page.collection %} 
	<li>
	<a href="{{ child.route }}">{{ child.title }}</a> 
	{{ child.header.author }} {{ child.header.date }}
	</li>
{% endfor %}

The items are listed in an order that I don’t understand, but it’s certainly not date order. Nor is it random, because if I change asc to desc I get the same order reversed.

Anyone know what I’m doing wrong?

date: is a reserved Grav header that expects dates to be in a strtotime compatible format: http://learn.getgrav.org/content/headers#date

Easiest solution is to change your dates so the format is something that Grav is going to understand.

I’ll have to check the code to see if we have support for a custom field. I think I added it at some point, but didn’t document/test it fully.

Ah. I didn’t realise that. Suppose I should have guessed. But … I changed date to pub_datethroughout, and I’m still not getting the expected ordering. Nor when I try to order by author. In fact, I now see they’re being listed in order of title, whether I ask for ordering by date or by author.

Just to confirm, this is the header code:

title: 'By author'
content:
    items: '@self.children'
    order:
        by: author
        dir: asc
```. 
Looking back at the docs on collection pages, i wonder whether ordering only applies to component pages of a modular page, rather than to ordinary children of an ordinary non-modular collection? That would be a nuisance.

Ok the problem is that author is not a valid type either. I did a bit of research and realized this already documented in the Collection Documentation

Also what is documented is that you can order: by: header.X- So this means you should be able to define:

title: 'By author'
content:
    items: '@self.children'
    order:
        by: header.author
        dir: asc

or

title: 'By author'
content:
    items: '@self.children'
    order: 
        by: header.pub_date
        dir: asc

I knew i had done this work already!

Tut tut, Thomas, rtfm. Sorry for missing that. Thanks - yet again.