Filtering items where "date is greater than a specific date" via the API

The new items_page in the API contains multiple ways to filter the date column. I noticed that it’s not possible, as far as I can tell, to filter the date where it’s greater than a specific date. Is this functionality available, but just not documented?

I guess it might be possible by misusing the “between” operator and setting the end date sometime very far in the future. Though I’m guessing there may be a better way of doing this.

In addition, I’m a bit confused what the “PAST_DATETIME” and “FUTURE_DATETIME” compare values mean.

Thanks in advance for the advice!

The only thing that seems to be close is:

Oops: I read your sentence

after I finished my post. Anyhow, looks like the only way is to “misuse” the second date and search for “between”.

{
  boards(ids: [4048117859]) {
    items_page(
      query_params: {rules: [{column_id: "date4", compare_value: ["2023-02-26", "2999-12-31"], operator: between}]}
    ) {
      cursor
      items {
        id
        name
      }
    }
  }
}

Where the first ISO date is where you want to filter from and the second on is far in the future (who care about the year 3000 problem :slight_smile:). Look like the greater_than operator does not accept an ISO date, just the predefined ones from the documentation

1 Like

Yeah, using the “between” operator should work with a date far in the future.

I’m curious if this is what monday does internally for board filtering in their board UI (though maybe they’re not using the same public API we’re using).

Hello there,

Can you try using something like this?

{
  boards(ids: [1234567890]) {
    items_page(
      query_params: {rules: [{column_id: "date4", compare_value: ["EXACT", "2023-11-05"], operator: greater_than}]}
    ) {
      cursor
      items {
        id
        name
      }
    }
  }
}

Please let me know how that goes!

Cheers,
Matias

2 Likes

Looks like that works. Thanks!

That would probably be a good thing to add to the documentation here: Date.

2 Likes

Done! Thanks for the suggestion @PluginGenie and solution @Matias.Monday :clap:

2 Likes