Map GraphQL query to calendar

Hi. I am trying something very simple : I want to map my Linear issues to my calendar. Basicaly to display the tilte. The query works fine, I have tested it.

query {
  project (id:"cdfa8ccff4da") {
    issues {
      nodes {
        title
        dueDate
      }
    }
  }
}

I cannot seem to be able to reference it as a data source. I have used this function which worked for tables, but here I am stuck. I tried to put it in another query (written as a function) and reference that one but still doesn't work.


 getIssues.project.issues.nodes.map(item => ({
    title: item.title,
    start: item.dueDate,
    end : item.dueDate
  }));

Thanks for helping.

Hi @Cosmina_Boboc

Thanks for reaching out!

Can you share a sample response from the query? Are you seeing any error messages? Are you using the new calendar or the deprecated one?

Initially, it looks like you may need to add .data after getIssues

Here's a similar example using a different gql resource & the deprecated calendar:

hello! This is part of the response of the query

{
  "data": {
    "project": {
      "issues": {
        "nodes": [
          {
            "title": "[UI] CMS Integration Flow Sidebar",
            "dueDate": "2023-02-16"
          },
         {
            "title": "[StageRenderer/Arch] Change Props and State resolution to use solid instead of playground flows",
            "dueDate": null
          },
          {
            "title": "[Headless CMS] Check Flotiq API and map content",
            "dueDate": null
          },
          

I am using the new calendar and added the data as well, it seems to work! That was a little bit silly from my part. Do i need to do something extra in order for the events to appear in the calendar? because they are not displayed

i have modified the code to format the data similiar to what you have, and it still does not display

{{
 getIssues.data.project.issues.nodes.map(event => {
    if (!event.dueDate) {
      return;
    }

   let dateArr = event.dueDate.split("-");
    let start = new Date(dateArr[0], dateArr[1] - 1, dateArr[2]);
    start.setHours(0, 0, 0, 0);

    let end = new Date(dateArr[0], dateArr[1] - 1, dateArr[2]);
    end.setHours(0, 0, 0, 0);
    end.setDate(end.getDate() + 1);

    return {
      title: event.title,
      start: start,
      end: end
    };
  })
}}

Hi @Cosmina_Boboc!

Do you have the event id, title, start, & end fields filled out? It looks like your code should work :crossed_fingers: