Jump to content

createdStr formatting? Changing the format for the timestamp value in pageListLabel?


gornycreative
 Share

Recommended Posts

I thought I recalled somewhere seeing that it was possible to format the timstamps for the pageListLabel.

Did I dream it? Is that just a fantasy? Something like {created:YYYY-mm} or something like that?

Can the createdStr date format be configured in a setting someplace?

I can do this with other means but for some reason I felt like there was a way to do this...

Maybe I'm confusing it with being able to alter the date in the default child naming setting?

Link to comment
Share on other sites

Yes it is, I created an issue for the feature:

https://github.com/processwire/processwire-requests/issues/514

Essentially I would like to be able to use something like {created:yy-mm} to be able to show alternative forms of the datetime in the label.

Should be an easy fix since the parsing code already exists in the PagesNames class (in theory).

Link to comment
Share on other sites

1 hour ago, gornycreative said:

How did you get to that API ref page?

I could only find this one, which is empty.

https://processwire.com/api/ref/pages/names/

If you click on the return value "PagesNames" you can get there. As to where / how I encountered it, it was from the "Name format for children" option in the ProcessTemplate edit page:

1439100235_Screenshot2023-12-30at22_40_53.thumb.png.9457502b001353cd2b76efd3af695153.png

518583122_Screenshot2023-12-30at22_41_15.thumb.png.bf232881bef3c42dfaa8c5b5824c26bd.png

  • Thanks 1
Link to comment
Share on other sites

Yeah I did find it that way as well.

Thanks!

I also forgot until I did a code audit yesterday that it is pretty trivial to override the getPageListLabel() method when using page classes. It still might be worth bringing the parsing over for folks not interested in doing it that way.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...