[PR #24401] feat(trigger-schedule): simplify timezone handling with user-centric approach #30612

Closed
opened 2026-02-21 20:47:53 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/24401

State: closed
Merged: Yes


Related #24001 #23981

🎯 Overview

This PR implements a user-centric timezone approach for the trigger schedule component, fundamentally simplifying timezone handling in the frontend while ensuring accurate scheduling.

Core Principle: "What You Configure Is What Executes"

  • User in Beijing configures "2:30 PM" → Executes at Beijing 2:30 PM
  • User in New York configures "2:30 PM" → Executes at New York 2:30 PM
  • No mental overhead for users regarding UTC or timezone conversions

🔧 Key Changes

1. TimePicker Timezone Fix

  • Fixed timezone parameter passing to TimePicker component
  • Eliminates time offset issues in UI configuration

2. Unified Timezone Handling

  • All frequency modes (hourly, daily, weekly, monthly) use consistent user timezone
  • Cron expressions properly parsed in user timezone context

3. Clean Data Architecture

  • Frontend: Pure configuration collection + display formatting
  • Backend: Receives timezone + configuration for proper execution
  • Clear separation of concerns

📊 Technical Details

Before: Complex UTC conversions and timezone juggling in frontend
After: Simple user timezone-based calculations with clean backend handoff

Affected Components

  • TimePicker timezone parameter
  • All execution time calculations
  • Next execution time display
  • Cron expression parsing
  • All frequency modes (hourly/daily/weekly/monthly)

Testing

  • All 94 tests passing
  • 82.36% statement coverage
  • Edge cases covered
  • Timezone conversion scenarios validated

🎯 Benefits

  • 🚀 Simplified Logic: Removed complex timezone conversion utilities
  • 🎯 Better UX: Intuitive time configuration without timezone confusion
  • 🔧 Clean Architecture: Clear frontend/backend responsibility separation
  • 🛡️ Fewer Bugs: Eliminates timezone edge cases and inconsistencies
  • 📈 Maintainable: Easier to understand and modify

🧪 Verification

pnpm test trigger-schedule  # All tests pass

Status: Ready for review - Complete timezone simplification with comprehensive test coverage

**Original Pull Request:** https://github.com/langgenius/dify/pull/24401 **State:** closed **Merged:** Yes --- Related #24001 #23981 ## 🎯 Overview This PR implements a **user-centric timezone approach** for the trigger schedule component, fundamentally simplifying timezone handling in the frontend while ensuring accurate scheduling. ### Core Principle: **"What You Configure Is What Executes"** - User in Beijing configures "2:30 PM" → Executes at Beijing 2:30 PM - User in New York configures "2:30 PM" → Executes at New York 2:30 PM - No mental overhead for users regarding UTC or timezone conversions ## 🔧 Key Changes ### 1. **TimePicker Timezone Fix** - Fixed timezone parameter passing to TimePicker component - Eliminates time offset issues in UI configuration ### 2. **Unified Timezone Handling** - All frequency modes (hourly, daily, weekly, monthly) use consistent user timezone - Cron expressions properly parsed in user timezone context ### 3. **Clean Data Architecture** - Frontend: Pure configuration collection + display formatting - Backend: Receives timezone + configuration for proper execution - Clear separation of concerns ## 📊 Technical Details **Before**: Complex UTC conversions and timezone juggling in frontend **After**: Simple user timezone-based calculations with clean backend handoff ### Affected Components - ✅ TimePicker timezone parameter - ✅ All execution time calculations - ✅ Next execution time display - ✅ Cron expression parsing - ✅ All frequency modes (hourly/daily/weekly/monthly) ### Testing - ✅ All 94 tests passing - ✅ 82.36% statement coverage - ✅ Edge cases covered - ✅ Timezone conversion scenarios validated ## 🎯 Benefits - **🚀 Simplified Logic**: Removed complex timezone conversion utilities - **🎯 Better UX**: Intuitive time configuration without timezone confusion - **🔧 Clean Architecture**: Clear frontend/backend responsibility separation - **🛡️ Fewer Bugs**: Eliminates timezone edge cases and inconsistencies - **📈 Maintainable**: Easier to understand and modify ## 🧪 Verification ```bash pnpm test trigger-schedule # All tests pass ``` **Status**: ✅ Ready for review - Complete timezone simplification with comprehensive test coverage
yindo added the pull-request label 2026-02-21 20:47:53 -05:00
yindo closed this issue 2026-02-21 20:47:53 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#30612