Drupal 7 and Page Manager: add Selection rules based on dates

615 views Asked by At

I have a content type article with a field date.

I am trying to fire a variant from Page Manager by defining a selection rule based on a date field.

What I am trying to do is applying this variant when

  • the node type is article
  • field date, start date < now < field date, end date

I can define the first condition but I can't figure out how to make a condition based on a date. Is it possible or not? I couldn't find more information about this.

Thanks

1

There are 1 answers

1
user3065518 On

I managed to do this finally by writing a PHP Code Selection Rule.

I got from the exposed $contexts variable the start and end values for date field and I wrote a simple condition to check if "now" is in between the two dates.

Beware that the dates are stored in UTC format in the field and your site/users might be in a different timezone.