the views date field handler allows to format the dates as time ago, by using the function format_interval.

the attached patch allows to use the options field to set the granularity for this function, while it keeps the default granularity of 2.

attached patch is for views 4.7.x

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

fago’s picture

Title: allow customizing date intverval granularity » allow customizing date interval granularity
FileSize
1013 bytes

this one is for views 5.x

merlinofchaos’s picture

Status: Needs review » Active

Applied; but -- it seems like the use of this needs documenting somewhere. Leaving this as active.

fago’s picture

yep, it seems like that the custom formatter is also undocumented..

fago’s picture

ok, here is it:
dokumentation patch for 5.0

fago’s picture

Status: Active » Needs review
FileSize
1.42 KB

and here is one for 4.7
sry for the lateness..

merlinofchaos’s picture

Status: Needs review » Fixed

Applied. Thanks fago!

Anonymous’s picture

Status: Fixed » Closed (fixed)
davidzz’s picture

Version: 4.7.x-1.x-dev » 6.x-2.x-dev
Priority: Minor » Normal
Status: Closed (fixed) » Active

I would like to reopen this for Views 2 Drupal 6... The ability for customized date interval granularity (eg. within 2 days) would be highly useful.

davidzz’s picture

Assigned: fago » Unassigned
dawehner’s picture

Status: Active » Fixed

Select on the date format: time age, or raw time ago and put something into the custom date format textfield.

davidzz’s picture

Status: Fixed » Needs review

The date format does not allow additions as far as I can tell, and the raw time ago option is only used in filters - not sort criteria.

I'ld like to be able to sort with a granularity of 2 days (or some other time interval), which I don't have the option for at the moment.

Apologize in advance if I'm mistaken somehow.

dawehner’s picture

but this has nothing todo with the old patch!.

merlinofchaos’s picture

Version: 6.x-2.x-dev » 4.7.x-1.x-dev
Priority: Normal » Minor
Status: Needs review » Closed (fixed)

Restoring original state.