From c2185c8feba4d24689f07b884bb85c1e5809d160 Mon Sep 17 00:00:00 2001 From: Michael Kret Date: Fri, 3 Jan 2025 07:36:08 +0200 Subject: [PATCH] fix --- .../nodes/Google/Calendar/CalendarDescription.ts | 4 ++-- .../nodes/Google/Calendar/EventDescription.ts | 4 ++-- .../nodes/Google/Calendar/GoogleCalendar.node.ts | 11 +++++++---- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/packages/nodes-base/nodes/Google/Calendar/CalendarDescription.ts b/packages/nodes-base/nodes/Google/Calendar/CalendarDescription.ts index d2d2950f17..f172f976c8 100644 --- a/packages/nodes-base/nodes/Google/Calendar/CalendarDescription.ts +++ b/packages/nodes-base/nodes/Google/Calendar/CalendarDescription.ts @@ -87,7 +87,7 @@ export const calendarFields: INodeProperties[] = [ }, }, default: '', - description: 'Start of the interval', + description: 'Start of the interval, if not specified will default to now', }, { displayName: 'End Time', @@ -101,7 +101,7 @@ export const calendarFields: INodeProperties[] = [ }, }, default: '', - description: 'End of the interval', + description: 'End of the interval, if not specified will default to Start Time plus 1 hour', }, { displayName: 'Options', diff --git a/packages/nodes-base/nodes/Google/Calendar/EventDescription.ts b/packages/nodes-base/nodes/Google/Calendar/EventDescription.ts index 6892c88152..d32e55cdf4 100644 --- a/packages/nodes-base/nodes/Google/Calendar/EventDescription.ts +++ b/packages/nodes-base/nodes/Google/Calendar/EventDescription.ts @@ -115,7 +115,7 @@ export const eventFields: INodeProperties[] = [ }, }, default: '', - description: 'Start time of the event', + description: 'Start time of the event, if not specified will default to now', }, { displayName: 'End', @@ -129,7 +129,7 @@ export const eventFields: INodeProperties[] = [ }, }, default: '', - description: 'End time of the event', + description: 'End time of the event, if not specified will default to start time plus 1 hour', }, { displayName: 'Use Default Reminders', diff --git a/packages/nodes-base/nodes/Google/Calendar/GoogleCalendar.node.ts b/packages/nodes-base/nodes/Google/Calendar/GoogleCalendar.node.ts index 189f737888..ef1c5ad689 100644 --- a/packages/nodes-base/nodes/Google/Calendar/GoogleCalendar.node.ts +++ b/packages/nodes-base/nodes/Google/Calendar/GoogleCalendar.node.ts @@ -148,8 +148,10 @@ export class GoogleCalendar implements INodeType { const calendarId = decodeURIComponent( this.getNodeParameter('calendar', i, '', { extractValue: true }) as string, ); - const timeMin = this.getNodeParameter('timeMin', i) as string; - const timeMax = this.getNodeParameter('timeMax', i) as string; + const timeMin = (this.getNodeParameter('timeMin', i) as string) || moment().format(); + const timeMax = + (this.getNodeParameter('timeMax', i) as string) || + moment(timeMin).add(1, 'hour').format(); const options = this.getNodeParameter('options', i); const outputFormat = options.outputFormat || 'availability'; const tz = this.getNodeParameter('options.timezone', i, '', { @@ -200,8 +202,9 @@ export class GoogleCalendar implements INodeType { const calendarId = encodeURIComponentOnce( this.getNodeParameter('calendar', i, '', { extractValue: true }) as string, ); - const start = this.getNodeParameter('start', i) as string; - const end = this.getNodeParameter('end', i) as string; + const start = (this.getNodeParameter('start', i) as string) || moment().format(); + const end = + (this.getNodeParameter('end', i) as string) || moment(start).add(1, 'hour').format(); const useDefaultReminders = this.getNodeParameter('useDefaultReminders', i) as boolean; const additionalFields = this.getNodeParameter('additionalFields', i);