Blueprint page query depending on date value

Hi,

I have a “Project” folder with a series of “Open Call” folders organized as children. I would like to be able to organize my project.yml blueprint to display a list of ‘Open Call‘ pages based on their end date rather than their status (listed / unlisted / draft). Each Open Call opencall.yml blueprint has a field for startDate and endDate with type: date that is filled in by the user.

I want to organize the project.yml to display

  • Draft Open Calls (status draft)
  • Current Open Calls (end dates >= today)
  • Past Open Calls (end dates < today)

I tried the page query by following this Guide / Blueprints / Query language on my project.yml

      openCallActive:
        image: false
        label: Current
        text: "{{ page.title }}: {{ page.heading }}"
        info: "{{ page.startDate.toDate('M d, Y') }} to {{ page.endDate.toDate('M d, Y') }}"
        type: pages
        template: opencall
        query: page.children.published.endDate.toDate() >= today

this is the excerpt from my opencall.yml
header:


    type: fields
    fields:
      title:
        label: Title
        placeholder: "Call For Participants"
        spellcheck: true
        type: text
        required: true
      startDate:
        type: date
        label: From
        display: MMMM D, YYYY
        default: today
        required: true
        width: 1/2
      endDate:
        type: date
        label: To
        display: MMMM D, YYYY
        required: true
        width: 1/2

Let me know if this is possible ~~ thanks in advance!

The query syntax is not quite correct.
Try:

query: page.children.published.filterBy('endDate', 'date >' , 'today')

If that doesn’t work, you might need a custom method.

1 Like

Thank you, this worked! I appreciate your help :slight_smile: