Query items based on the Timetime column with a specific day, and specific time range

Hi there,
I’m working on the Timeline column. To implement a function in my app, I need to get the item by timeline column with a specific day, a specific time time range.
I had tested some cases, and monday.com API already supports so well with operator: between. See:

items_page(
      limit: $limit
      query_params: {rules: [
        {
        column_id: $timelineField,
        compare_value: ["2023-11-19", "2023-12-02"],
        compare_attribute: "START_DATE", 
        operator: between
        },    
        {
          column_id: $timelineField, 
          compare_value: ["2023-11-19", "2023-12-02"],
          compare_attribute: "END_DATE",
          operator: between
        }
      ], 
        operator: or
      }
    )

However, it doesn’t seem working well on greater_than_or_equals, greater_than, lower_than_or_equals, and lower_than. It still works fine with other defined compare values such as "TODAY" , "TOMORROW",. But what I need is a special day. so this is the query I tried:

items_page(
      limit: $limit
      query_params: {
        rules: [
          {
          column_id: $timelineField,
          compare_value: ["2023-10-20"],
          compare_attribute: "START_DATE",
          operator: greater_than_or_equals
          }
     		]
      }
    

Maybe, I got something wrong. Please advise me about how to get all the items planned before/after a specific day,

1 Like

Hello there @t.h,

I am not sure I understand what you are trying to get.

Are you trying to retrieve all items where the start date of the “timeline” column equals a specific date?

1 Like

Hi Matias,

Are you trying to retrieve all items where the start date of the “timeline” column equals a specific date?

Yes, that’s correct. Additionally, I also want to retrieve all items before/after a specific date.
Hope you can help. Thank you.

Hello again @t.h,

This will get you the items where the start date of the timeline column is 2023-11-11:

{
  boards(ids: 1234567890) {
    items_page(
      query_params: {rules: {column_id: "timeline", compare_value: ["2023-11-11","2023-11-11"], compare_attribute: "START_DATE", operator: between}}
    ) {
      items {
        name
      }
    }
  }
}

I will check about the other query you need with the team and let you know!

2 Likes

Hello again,

You can use a query like this one to get the items in which the start date of the timeline column is before a specific date:

{
  boards(ids: 1234567890) {
    items_page(
      query_params: {rules: {column_id: "timeline", compare_value: ["EXACT", "2023-11-11"], compare_attribute: "START_DATE", operator: lower_than}}
    ) {
      items {
        name
      }
    }
  }
}

Cheers,
Matias

2 Likes

thank you so much @Matias.Monday
You saved my life. It works perfectly :ok_hand:

2 Likes

Happy to help @t.h !!!

1 Like