Skip to content

Conversation

@Sg312
Copy link
Contributor

@Sg312 Sg312 commented Jan 14, 2026

Summary

Defaults schedule block timezone to user's default timezone

Type of Change

  • Bug fix

Testing

Manual

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Jan 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Review Updated (UTC)
docs Skipped Skipped Jan 14, 2026 0:30am

@Sg312 Sg312 merged commit eb52f69 into staging Jan 14, 2026
6 of 7 checks passed
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 14, 2026

Greptile Summary

Changed schedule block timezone default from hardcoded 'UTC' to user's browser timezone using Intl.DateTimeFormat().resolvedOptions().timeZone. This improves UX by defaulting to the user's local timezone instead of requiring manual selection.

Key changes:

  • Line 175: Replaced value: () => 'UTC' with value: () => Intl.DateTimeFormat().resolvedOptions().timeZone
  • Backend correctly handles any valid IANA timezone via Croner library
  • Fallback to 'UTC' exists in getScheduleTimeValues() if timezone is empty

Minor consideration:

  • The dropdown has 34 predefined timezone options, but user's browser may return a timezone not in this list (e.g., America/Los_Angeles is in the list, but America/Phoenix is not). The dropdown is searchable, so users can still find and select timezones, but the initial default may not appear as "selected" in the UI if it's not in the predefined options.

Confidence Score: 4/5

  • This PR is safe to merge with minimal risk
  • The change is a simple one-liner that improves user experience by defaulting to the browser's timezone. The Intl API is well-supported across modern browsers, and the backend has proper fallback handling (defaults to 'UTC' if empty). The only minor consideration is the UX edge case where a user's timezone might not be in the predefined dropdown list, but this doesn't break functionality.
  • No files require special attention

Important Files Changed

Filename Overview
apps/sim/blocks/blocks/schedule.ts Changed timezone default from hardcoded 'UTC' to user's browser timezone using Intl API. Implementation is sound but may show unselected value in dropdown if user's timezone isn't in the predefined list.

Sequence Diagram

sequenceDiagram
    participant User
    participant Browser
    participant ScheduleBlock
    participant IntlAPI as Intl.DateTimeFormat
    participant Backend
    participant Croner

    User->>Browser: Create new schedule
    Browser->>ScheduleBlock: Initialize schedule block
    ScheduleBlock->>IntlAPI: Intl.DateTimeFormat().resolvedOptions()
    IntlAPI-->>ScheduleBlock: {timeZone: "America/New_York"}
    ScheduleBlock->>ScheduleBlock: Set timezone default value
    ScheduleBlock-->>Browser: Render with user's timezone
    User->>Browser: Configure schedule & save
    Browser->>Backend: POST workflow with timezone
    Backend->>Backend: validateScheduleBlock()
    Backend->>Backend: getScheduleTimeValues() (defaults to UTC if empty)
    Backend->>Croner: Create cron with timezone
    Croner-->>Backend: Validated schedule
    Backend-->>Browser: Success
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

{ label: 'Auckland (UTC+12)', id: 'Pacific/Auckland' },
],
value: () => 'UTC',
value: () => Intl.DateTimeFormat().resolvedOptions().timeZone,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: User's browser timezone may not be in dropdown options. If Intl.DateTimeFormat().resolvedOptions().timeZone returns a timezone not in the predefined list (lines 132-174), the dropdown won't show it as selected. Consider adding fallback logic to match to closest option or ensure dropdown displays values not in options list.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/sim/blocks/blocks/schedule.ts
Line: 175:175

Comment:
**style:** User's browser timezone may not be in dropdown options. If `Intl.DateTimeFormat().resolvedOptions().timeZone` returns a timezone not in the predefined list (lines 132-174), the dropdown won't show it as selected. Consider adding fallback logic to match to closest option or ensure dropdown displays values not in options list.

How can I resolve this? If you propose a fix, please make it concise.

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.

2 participants