-2

Hello everyone i am working with views ind Drupal8 ,i have a 5 content types that contains all a field 'date' , so i want to display just the content types with date == 2020 , how can i do it the with back-office without code, if not we can d it by code.

  • Can't you just add a filter in views for your date field for greater than 2020-01-01 and a 2nd filter for less than 31-12-2020? – Leigh Feb 11 at 15:23
  • where can i find this option? – love coding Feb 11 at 15:41
  • In your view in the "Filter criteria" section click add, select your date field, then in the popup select "Is greater than" and enter your start date in the box – Leigh Feb 11 at 15:45
  • thank you bro ! – love coding Feb 11 at 15:50
2

I Agree with Leigh. I regularly use the filter operator 'is between'. Click on the 'add' button aginst filter criteria, select start date and enter 1st jan 2020 then 31st December in the end date box and job done.

0

To add date filter by year without code check Views Year Filter module.
From module description:

This module add views filter by year exact, instead of full date like mm-dd-yyyy you can use date year like yyyy.

  • There's no reason to add a module to do this. Adding a date filter and using "in between" as @David Connell mentions will do it. – codesmith Feb 13 at 17:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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