Google Calendar Time

Hello, when i manually input start date and end date, i am able to create an event at google calendar,
however, when i use the expression, it is not working anymore.

May i know if this is because of of the time format?

Hi @Benjamin123, Google Calendar could indeed be rejecting your time format, if everything else works. From looking at Events: insert  |  Calendar API  |  Google Developers, Google expects RFC3339-formatted values. Values like 2022-01-11T16:59:24.058Z worked fine for me when I tested this:

You could use the Date & Time node to reformat your timestamps, e.g. like so:

Example Workflow
{
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "values": {
          "string": [
            {
              "name": "start",
              "value": "2022-01-10 10:00:00"
            },
            {
              "name": "end",
              "value": "2022-01-10 11:00:00"
            }
          ]
        },
        "options": {}
      },
      "name": "Set",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        460,
        300
      ]
    },
    {
      "parameters": {
        "calendar": "[email protected]",
        "start": "={{$json[\"start\"]}}",
        "end": "={{$json[\"end\"]}}",
        "additionalFields": {
          "summary": "Foo"
        }
      },
      "name": "Google Calendar",
      "type": "n8n-nodes-base.googleCalendar",
      "typeVersion": 1,
      "position": [
        1120,
        300
      ],
      "credentials": {
        "googleCalendarOAuth2Api": {
          "id": "66",
          "name": "[email protected]"
        }
      }
    },
    {
      "parameters": {
        "value": "={{$json[\"start\"]}}",
        "dataPropertyName": "start",
        "custom": true,
        "toFormat": "YYYY-MM-DDTHH:mm:ssZ",
        "options": {}
      },
      "name": "Format Start",
      "type": "n8n-nodes-base.dateTime",
      "typeVersion": 1,
      "position": [
        680,
        300
      ]
    },
    {
      "parameters": {
        "value": "={{$json[\"end\"]}}",
        "dataPropertyName": "end",
        "custom": true,
        "toFormat": "YYYY-MM-DDTHH:mm:ssZ",
        "options": {}
      },
      "name": "Format End",
      "type": "n8n-nodes-base.dateTime",
      "typeVersion": 1,
      "position": [
        900,
        300
      ]
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Set",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set": {
      "main": [
        [
          {
            "node": "Format Start",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Start": {
      "main": [
        [
          {
            "node": "Format End",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format End": {
      "main": [
        [
          {
            "node": "Google Calendar",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

it is still not working initially, but after i delete the existing google calendar node and recreate a new node, it is working … :grinning:

thank you

2 Likes