Skip to content

Conversation

@michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented Jul 31, 2025

Resolves #17622

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling of event start and end times when creating Google Calendar events, ensuring correct support for both all-day and timed events.
  • Chores

    • Updated component and package versions.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 31, 2025

Walkthrough

The 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 date or dateTime field. The component and package versions are incremented accordingly.

Changes

Cohort / File(s) Change Summary
Create Event Action Logic Update
components/google_calendar/actions/create-event/create-event.mjs
Refactored event start/end time assignment to explicitly set date or dateTime fields based on input length; removed getDateParam usage; incremented action version.
Component Version Bump
components/google_calendar/package.json
Incremented package version from 0.5.8 to 0.5.9.

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
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Assessment against linked issues

Objective Addressed Explanation
Correctly distinguish and map eventStartDate and eventEndDate to either both date or both dateTime fields in the event creation payload (#17622)
Remove or refactor logic that could cause mismatched types for start/end times in the Google Calendar API request (#17622)

Poem

A calendar hop, a leap in the code,
Now dates and times take the right road.
With date or dateTime, the logic is neat,
No more server errors, that's quite a feat!
🐇✨ The rabbit approves—events now complete!

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch issue-17622

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@vercel
Copy link

vercel bot commented Jul 31, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs-v2 ⬜️ Ignored (Inspect) Jul 31, 2025 4:15pm
pipedream-docs ⬜️ Ignored (Inspect) Jul 31, 2025 4:15pm
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Jul 31, 2025 4:15pm

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between 752939a and b91488e.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is 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.

Copy link
Collaborator

@jcortes jcortes left a 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!

@vunguyenhung vunguyenhung merged commit 0359384 into master Aug 1, 2025
11 checks passed
@vunguyenhung vunguyenhung deleted the issue-17622 branch August 1, 2025 00:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] google_calendar create-event

4 participants