-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Google Calendar create-event - simplify start & end date logic #17893
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe changes update the Google Calendar "Create Event" action to improve how event start and end times are structured in the request payload. The logic now distinguishes between all-day and timed events by conditionally setting either the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CreateEventAction
participant GoogleCalendarAPI
User->>CreateEventAction: Provide eventStartDate, eventEndDate, timeZone
CreateEventAction->>CreateEventAction: Check length of eventStartDate/endDate
alt All-day event (length <= 10)
CreateEventAction->>GoogleCalendarAPI: Send { date, timeZone }
else Timed event (length > 10)
CreateEventAction->>GoogleCalendarAPI: Send { dateTime, timeZone }
end
GoogleCalendarAPI-->>CreateEventAction: Response
CreateEventAction-->>User: Result
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Assessment against linked issues
Poem
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
components/google_calendar/actions/create-event/create-event.mjs (1)
147-164: Consider more robust date format detection.The string length check (
length <= 10) assumes a specific date format but could be fragile with different ISO 8601 variations. Also, timezone may not be needed for all-day events.Consider a more robust approach:
+ // More robust date format detection + const isDateOnly = (dateStr) => { + return dateStr && /^\d{4}-\d{2}-\d{2}$/.test(dateStr.trim()); + }; + + const startIsDateOnly = isDateOnly(this.eventStartDate); + const endIsDateOnly = isDateOnly(this.eventEndDate); const data = { calendarId: this.calendarId, sendUpdates: this.sendUpdates, resource: { summary: this.summary, location: this.location, description: this.description, start: { - date: this.eventStartDate?.length <= 10 + date: startIsDateOnly ? this.eventStartDate : undefined, - dateTime: this.eventStartDate?.length > 10 + dateTime: !startIsDateOnly ? this.eventStartDate : undefined, - timeZone, + timeZone: !startIsDateOnly ? timeZone : undefined, }, end: { - date: this.eventEndDate?.length <= 10 + date: endIsDateOnly ? this.eventEndDate : undefined, - dateTime: this.eventEndDate?.length > 10 + dateTime: !endIsDateOnly ? this.eventEndDate : undefined, - timeZone, + timeZone: !endIsDateOnly ? timeZone : undefined, },
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (2)
components/google_calendar/actions/create-event/create-event.mjs(2 hunks)components/google_calendar/package.json(1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#17538
File: components/aircall/sources/new-sms/new-sms.mjs:19-25
Timestamp: 2025-07-09T18:07:12.426Z
Learning: In Aircall API webhook payloads, the `created_at` field is returned as an ISO 8601 string format (e.g., "2020-02-18T20:52:22.000Z"), not as milliseconds since epoch. For Pipedream components, this needs to be converted to milliseconds using `Date.parse()` before assigning to the `ts` field in `generateMeta()`.
📚 Learning: in aircall api webhook payloads, the `created_at` field is returned as an iso 8601 string format (e....
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#17538
File: components/aircall/sources/new-sms/new-sms.mjs:19-25
Timestamp: 2025-07-09T18:07:12.426Z
Learning: In Aircall API webhook payloads, the `created_at` field is returned as an ISO 8601 string format (e.g., "2020-02-18T20:52:22.000Z"), not as milliseconds since epoch. For Pipedream components, this needs to be converted to milliseconds using `Date.parse()` before assigning to the `ts` field in `generateMeta()`.
Applied to files:
components/google_calendar/actions/create-event/create-event.mjs
📚 Learning: in `components/gainsight_px/actions/create-account/create-account.mjs`, the action name should be "c...
Learnt from: jcortes
PR: PipedreamHQ/pipedream#14467
File: components/gainsight_px/actions/create-account/create-account.mjs:4-6
Timestamp: 2024-10-30T15:24:39.294Z
Learning: In `components/gainsight_px/actions/create-account/create-account.mjs`, the action name should be "Create Account" instead of "Create Memory".
Applied to files:
components/google_calendar/actions/create-event/create-event.mjs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Verify TypeScript components
- GitHub Check: Publish TypeScript components
- GitHub Check: Lint Code Base
- GitHub Check: pnpm publish
🔇 Additional comments (2)
components/google_calendar/package.json (1)
3-3: LGTM! Appropriate version bump for bug fix.The patch version increment from 0.5.8 to 0.5.9 correctly follows semantic versioning for this bug fix.
components/google_calendar/actions/create-event/create-event.mjs (1)
10-10: LGTM! Appropriate version bump for bug fix.The patch version increment from 0.2.5 to 0.2.6 correctly follows semantic versioning for this bug fix.
jcortes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @michelle0927 lgtm! Ready for QA!
Resolves #17622
Summary by CodeRabbit
Bug Fixes
Chores