I have a date field and I would like find the most recent one on this field with MAX aggregation.

But I can only get the result as a timestamp instead of the format I choose at the field settings form.

Is it possible to format the field after aggregation?

Comments

leetom created an issue. See original summary.

rdeboer’s picture

Hi leetom,
No not out of the box, I'm afraid.
Will required a little PHP hack.
Rik

leetom’s picture

Hi Rik,

Thanks for your reply!
I am wondering why the timestamp is displayed.
The fields should be rendered and then aggregated, as the title field is correctly renderd as a link.
If the datetime field is rendered and then sorted to get the max value, the result should be a time string instead of timestamp.

rdeboer’s picture

Good point!
If I have time, I'll have a look at it.
Rik

leetom’s picture

Thanks a lot!

I will dig into the code too, but I currently have no idea how this module works. =_=

gascon’s picture

Leetom, did you finally got to make this work? Or, Rik, did you have time to take a look into this? :) I'm currently having the same issue.

morbiD’s picture

Title: The date field is not formated after aggregation » Date fields are not formatted after aggregation
Version: 7.x-1.4 » 7.x-1.x-dev
Category: Support request » Bug report
Status: Active » Needs review
StatusFileSize
new5.1 KB

Similar issue here. I'm trying to use the "Maximum" function on the "created" date of some nodes but it always renders as a timestamp, regardless of what date format is selected in the field configuration.

The reason seems to be that Views Aggregator Plus is treating the timestamp as a number and rendering it with the format_number() function.

I've attached a patch that seems to work for my particular view. I've basically just copied the date rendering code from views_handler_field_date, so hopefully there's nothing wrong with it.

tr’s picture

Note, the PHP 5.3 test failed because of a bug in Views unrelated to the patch in #7. See #3039953: PHP 5.3.x fix for syntax changes Views 3.21

alexh’s picture

The patch in #7 works well and solves the problem for me.