This commit is contained in:
Michael Kret 2025-01-03 07:36:08 +02:00
parent 4498e35192
commit c2185c8feb
3 changed files with 11 additions and 8 deletions

View file

@ -87,7 +87,7 @@ export const calendarFields: INodeProperties[] = [
}, },
}, },
default: '', default: '',
description: 'Start of the interval', description: 'Start of the interval, if not specified will default to now',
}, },
{ {
displayName: 'End Time', displayName: 'End Time',
@ -101,7 +101,7 @@ export const calendarFields: INodeProperties[] = [
}, },
}, },
default: '', default: '',
description: 'End of the interval', description: 'End of the interval, if not specified will default to Start Time plus 1 hour',
}, },
{ {
displayName: 'Options', displayName: 'Options',

View file

@ -115,7 +115,7 @@ export const eventFields: INodeProperties[] = [
}, },
}, },
default: '', default: '',
description: 'Start time of the event', description: 'Start time of the event, if not specified will default to now',
}, },
{ {
displayName: 'End', displayName: 'End',
@ -129,7 +129,7 @@ export const eventFields: INodeProperties[] = [
}, },
}, },
default: '', 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', displayName: 'Use Default Reminders',

View file

@ -148,8 +148,10 @@ export class GoogleCalendar implements INodeType {
const calendarId = decodeURIComponent( const calendarId = decodeURIComponent(
this.getNodeParameter('calendar', i, '', { extractValue: true }) as string, this.getNodeParameter('calendar', i, '', { extractValue: true }) as string,
); );
const timeMin = this.getNodeParameter('timeMin', i) as string; const timeMin = (this.getNodeParameter('timeMin', i) as string) || moment().format();
const timeMax = this.getNodeParameter('timeMax', i) as string; const timeMax =
(this.getNodeParameter('timeMax', i) as string) ||
moment(timeMin).add(1, 'hour').format();
const options = this.getNodeParameter('options', i); const options = this.getNodeParameter('options', i);
const outputFormat = options.outputFormat || 'availability'; const outputFormat = options.outputFormat || 'availability';
const tz = this.getNodeParameter('options.timezone', i, '', { const tz = this.getNodeParameter('options.timezone', i, '', {
@ -200,8 +202,9 @@ export class GoogleCalendar implements INodeType {
const calendarId = encodeURIComponentOnce( const calendarId = encodeURIComponentOnce(
this.getNodeParameter('calendar', i, '', { extractValue: true }) as string, this.getNodeParameter('calendar', i, '', { extractValue: true }) as string,
); );
const start = this.getNodeParameter('start', i) as string; const start = (this.getNodeParameter('start', i) as string) || moment().format();
const end = this.getNodeParameter('end', i) as string; const end =
(this.getNodeParameter('end', i) as string) || moment(start).add(1, 'hour').format();
const useDefaultReminders = this.getNodeParameter('useDefaultReminders', i) as boolean; const useDefaultReminders = this.getNodeParameter('useDefaultReminders', i) as boolean;
const additionalFields = this.getNodeParameter('additionalFields', i); const additionalFields = this.getNodeParameter('additionalFields', i);