I need to count the number of consecutive years a user has been a member of our organization. For example, if they've been a member from in 2018, 2019, 2020 and 2021, their loyalty will be 4 years.
If they've been a member in 2018, 2019 and 2021, their loyalty will be 1 year (they missed 2020.)
I'm currently using Categories to assign a year to Users in Craft to do the assignment of a year to a person.
Hope that makes sense. I would very much appreciate some help on how to tackle it!
loyaltyScoreit's blank. I've not used reduce before so a bit unsure.
– supazu Apr 27 '21 at 05:46{% set currentYear = now|date('Y') ~ '/' ~ now|date_modify("+1 year")|date('y') %}{{ '2021/22'|slice(4) }}– James Smith Apr 28 '21 at 08:21