[PR #24359] refactor: comprehensive schedule trigger component redesign #30595

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

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

State: closed
Merged: Yes


Summary

Complete refactoring of the trigger-schedule component to implement unified timezone handling, simplified frequency modes, and enhanced data structure compatibility.

Key Changes

Architecture Improvements

  • Timezone Unification: Implemented user timezone display with UTC backend transmission
  • Mode Simplification: Removed 'once' frequency mode and simplified hourly execution model
  • Data Structure: Streamlined types and removed legacy fields (datetime, recur_every, recur_unit)

Component Restructure

  • Hourly Mode: Simplified to on_minute field only (execute every hour at minute X)
  • Weekly Mode: Added multi-select support following monthly pattern
  • Monthly Logic: Fixed edge case handling for invalid day selections (skip rather than fallback)
  • Default Frequency: Changed from daily to weekly

Data Structure Changes

// Removed fields
- datetime: Date
- recur_every: number
- recur_unit: 'hours' | 'days'

// Core structure maintained
{
  mode: 'visual' | 'cron',
  frequency: 'hourly' | 'daily' | 'weekly' | 'monthly',
  visual_config: {
    time?: string,           // User format display, UTC transmission
    weekdays?: string[],     // Multi-select support
    on_minute?: number,      // Hourly mode (0-59)
    monthly_days?: (number | 'last')[]
  },
  timezone: string,          // User timezone for display
  enabled: boolean
}

Technical Implementation

  • UTC Conversion: Automatic user time ↔ UTC conversion with format detection
  • Execution Calculator: Enhanced monthly logic to skip invalid days instead of fallback
  • Comprehensive Testing: 146 tests covering all modes, timezone handling, and edge cases
  • UI Components: Custom on_minute selector with left display + right slider design

Testing Coverage

  • Unit Tests: Complete coverage for all frequency modes
  • Timezone Tests: Round-trip conversion validation
  • Edge Cases: Monthly day selection, leap year handling, timezone boundaries
  • Integration: Full validation workflow testing

Related Issues

**Original Pull Request:** https://github.com/langgenius/dify/pull/24359 **State:** closed **Merged:** Yes --- ## Summary Complete refactoring of the trigger-schedule component to implement unified timezone handling, simplified frequency modes, and enhanced data structure compatibility. ## Key Changes ### Architecture Improvements - **Timezone Unification**: Implemented user timezone display with UTC backend transmission - **Mode Simplification**: Removed 'once' frequency mode and simplified hourly execution model - **Data Structure**: Streamlined types and removed legacy fields (datetime, recur_every, recur_unit) ### Component Restructure - **Hourly Mode**: Simplified to on_minute field only (execute every hour at minute X) - **Weekly Mode**: Added multi-select support following monthly pattern - **Monthly Logic**: Fixed edge case handling for invalid day selections (skip rather than fallback) - **Default Frequency**: Changed from daily to weekly ### Data Structure Changes ```typescript // Removed fields - datetime: Date - recur_every: number - recur_unit: 'hours' | 'days' // Core structure maintained { mode: 'visual' | 'cron', frequency: 'hourly' | 'daily' | 'weekly' | 'monthly', visual_config: { time?: string, // User format display, UTC transmission weekdays?: string[], // Multi-select support on_minute?: number, // Hourly mode (0-59) monthly_days?: (number | 'last')[] }, timezone: string, // User timezone for display enabled: boolean } ``` ### Technical Implementation - **UTC Conversion**: Automatic user time ↔ UTC conversion with format detection - **Execution Calculator**: Enhanced monthly logic to skip invalid days instead of fallback - **Comprehensive Testing**: 146 tests covering all modes, timezone handling, and edge cases - **UI Components**: Custom on_minute selector with left display + right slider design ## Testing Coverage - **Unit Tests**: Complete coverage for all frequency modes - **Timezone Tests**: Round-trip conversion validation - **Edge Cases**: Monthly day selection, leap year handling, timezone boundaries - **Integration**: Full validation workflow testing ## Related Issues - #23981 - #24001
yindo added the pull-request label 2026-02-21 20:47:51 -05:00
yindo closed this issue 2026-02-21 20:47:51 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#30595