2

How to print Date Field in Views in format "time ago" for "end dates"? If I config field in views like: Display: End date only, Formatter: Time ago. I get duration form Start date :(

Example for today (7 jun 2014). date field values: start 1 jan 2013, end 1 jan 2014. I wanna get: Expired - 5 mounths and 7 days. But views printing: Expired - 1 year, 5 mounths and 7 days.

1

You can write this in javascript to avoid caching issues and use the users machine time.

https://drupal.org/project/timeago

http://momentjs.com/

http://timeago.yarp.com/

otherwise there is a patch here: https://drupal.org/node/2026545

  • 1
    Thanks for the idea of conversion using js. I looked module "timeago". Great module, but it is impossible translate the strings (plurals strings). And there is a problem with the date fields if option "all day" is enabled. I'll try a custom js whit Drupal.formatPlural() or will use momentjs.com (looks powerfully). Sorry for my english. – Arthur Jun 8 '14 at 8:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.