1

Is there a way to use years as a date filter offset? What I want is to set it so that it it loads all content from the start of the previous year. So >= 01-01-2017 this year, >= 01-01-2018 next year, etc. Is there a way to do that in the View configuration so that it's dynamic? I'm sure I could do it with custom code by altering the query, but I'd rather avoid that.

  • Have you tried a <= filter? – mpdonadio Dec 17 '18 at 21:05
  • I would need it to be dynamic. So if I put a specific date I would have to update the configuration every year, which I don't want. What I want is to set it so that it it loads all content from the start of the previous year. So >= 01-01-2017 this year, >=01-01-2018 next year, etc. – user1205853 Dec 17 '18 at 21:11
  • now -1 year default value? – Kevin Dec 17 '18 at 21:38
  • @Kevin Nope that only covers 12/2017 to 12/2018 – user1205853 Dec 17 '18 at 21:59
2

It turns out this was more of a PHP strtotime() question. I just had to figure out the appropriate phrase to get the time frame I wanted, which is: "first day of january last year". I placed that phrase in the filter's offset value.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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