Jump to content

How to change the published date format in find lister


Mirza
 Share

Recommended Posts

On 25/07/2017 at 11:45 PM, Mirza said:

Can we change the date format to yyyy-mm-dd or any other?

Currently you cannot.  There is a @todo note in the code:

// @todo make this format customizable via wireDate()

https://github.com/processwire/processwire/blob/57b297fd1d828961b20ef29782012f75957d6886/wire/modules/Process/ProcessPageLister/ProcessPageLister.module#L1264-L1267

Edit: you cannot set the date format individually for the 'created', 'modified' and 'published' columns, but if you don't mind using the same format for all you can use this hook in /site/ready.php:

$wire->addHookBefore('ProcessPageLister::execute', function(HookEvent $event) {
    $lister = $event->object;
    $lister->nativeDateFormat = 'Y-m-d';
    // see https://processwire.com/api/ref/datetime/date/ for format options
});

 

  • Like 3
Link to comment
Share on other sites

  • 2 months later...

Recently I am fixing this issue, again, and I find this post in google. There's another solution that I found in the ListerPro forum before. The created, modified, publish date format can be changed via language translation. The language support module has to be installed in this case.

Go to Setting > Language > choose the language you use > Click Find Files to Translate button > click /wire\modules\Process\ProcessPageLister\ProcessPageLister.module and submit > translate "rel" field(should be listed on top) to wanted format like Y-m-d

Reference: https://github.com/processwire/processwire/blob/57b297fd1d828961b20ef29782012f75957d6886/wire/modules/Process/ProcessPageLister/ProcessPageLister.module#L238

  • Like 3
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

×
×
  • Create New...