Issue with pages sorted by date (kirby 3.2)

Hi there,

after the update to 3.2, I get an error when I am trying to save my changes. The page contains a numbers field. I think this is the problem.

Return value of Kirby\Cms\Page::createNum() must be of the type int, string returned

Thanks for your help.

Hm, I don’t quite see how the numbers field has anything to do with error message. CreateNum is responsible for page sorting. Do you use the numbers field for page sorting in your blueprint?

Where is the error thrown? In the Panel? On the frontend??

Ok, the numbers field has nothing to do with the error. The pages are sorted by date and the field has the key date. The Blueprint looks like this:

title: Event
num: page.date
...

In previous kirby versions (3.x.) this was working well.

When I change the blueprint like the example in the docs

title: Event
num: '{{ page.date.toDate("Ymd") }}'
...

the error is not showing up anymore (previously showing up in the panel), but the published page isn’t sorted in the right way.

0_page-slug

Any suggestions?

The example note.ymlStarterkit blueprint uses

num: date

Have you tested that?

Yes, same error message.

I don’t get an error message, but the sorting doesn’t work as expected anymore. Seems to be a bug.

I just found out that num: '{{ page.date.toDate("Ymd") }}' isn’t working because I use strftime. My fault. It should be num: '{{ page.date.toDate("%G%m%d") }}'

But num: date throws an error, this should be fixed, I think.

Hm, I can’t reproduce the error message, and after I deleted session data it worked again as expected.

Maybe the error is thrown because of your date format?

The field date has no custom format. Default setup. But it saves the time as well.

Here is the blueprint:

label: Datum
type: date
default: now
time: true
required: true

That’s the same set-up as in the note.yml blueprint.

I found out that the problem is using the date handler strftime. When I remove this line from the config file, everything works as expected.

I created an issue just in case:

Thanks. The function createNum located in kirby/src/Cms/PageActions.php has changed. That’s the problem.