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?
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | views_aggregator-date-format-2728033-0.patch | 5.1 KB | morbiD |
Comments
Comment #2
rdeboerHi leetom,
No not out of the box, I'm afraid.
Will required a little PHP hack.
Rik
Comment #3
leetom commentedHi 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.
Comment #4
rdeboerGood point!
If I have time, I'll have a look at it.
Rik
Comment #5
leetom commentedThanks a lot!
I will dig into the code too, but I currently have no idea how this module works. =_=
Comment #6
gascon commentedLeetom, 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.
Comment #7
morbiD commentedSimilar 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.
Comment #8
tr commentedNote, 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
Comment #9
alexh commentedThe patch in #7 works well and solves the problem for me.