I am trying to work through deprecation warning. I have not touched Craft in a few months, so I am a bit rusty.
The Deprecation Message is:
DateTime::year is deprecated. Use the |date('Y') filter instead.
The offending line is:
{% for year in now.year .. firstEntryEver.postDate.year %}
Here is the context:
{% set firstEntryEver = craft.entries.section('posts').orderBy('postDate asc').one() %}
{% for year in now.year .. firstEntryEver.postDate.year %}
<a href="/archives/{{ year }}" class="dropdown-item">
<i class="material-icons">date_range</i> {{ year }}</a>
{% endfor %}
So, how do I fix this?