Drupal 8.
Please help to find the best solution.
I have nodes that should display created date. If node created today text should be - "Today" If yesterday - "Yesterday". In other scenarios should display just creation date - 22/02/1999.
I've created custom field formatter to achieve this. And everything ok except one thing - caches.
Due drupal caches the node that created today, tomorrow should display "Yesterday". But tomorrow it will still display "Today" until I clear the cache manually. After cache clearing, it will say "Yesterday", like it should.
Please help me to resolve this issue. I will be glad to avoid using
'#cache' => [
'max-age' => 0,
]