Jump to content

Recommended Posts

Posted

In a lister find, published column is showing a string as shown in attached screenshot.

59772f446588d_ScreenShot2017-07-25at3_42_38PM.thumb.png.28cdc8b8a037b53af3134f018d367e2e.png

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

Posted
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
  • 2 months later...
Posted

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

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
×
×
  • Create New...