Change record status: 
Project: 
Introduced in branch: 
8.1.x
Introduced in version: 
8.1.9
Description: 

#2500525: Time ago/hence date/time formatting breaks caching; needs appropriate max age introduced the FormattedDateDiff object. It mistakenly has a method ::getMaxAge() to get the TTL for the render array for this object. Since this object implements CacheableDependencyInterface(), the proper method to implement is ::getCacheMaxAge().

Instead of using

$max_age = $formattedDateDiff->getMaxAge();

use

$max_age = $formattedDateDiff->getCacheMaxAge();

The ::getMaxAge() method has been marked as deprecated in 8.1.9 and will be removed before Drupal 9.0.0.

Impacts: 
Module developers
Updates Done (doc team, etc.)
Online documentation: 
Not done
Theming guide: 
Not done
Module developer documentation: 
Not done
Examples project: 
Not done
Coder Review: 
Not done
Coder Upgrade: 
Not done
Other: 
Other updates done