From 99d9657af8f09657e8105dbb5755b6f9dcf06a4c Mon Sep 17 00:00:00 2001 From: lyzno1 Date: Mon, 13 Oct 2025 17:07:33 +0800 Subject: [PATCH] feat(workflow): integrate timezone display into execution time format for better readability --- .../components/next-execution-times.tsx | 3 --- .../utils/execution-time-calculator.ts | 13 ++++++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/web/app/components/workflow/nodes/trigger-schedule/components/next-execution-times.tsx b/web/app/components/workflow/nodes/trigger-schedule/components/next-execution-times.tsx index f7a0c2e483..02e85e2724 100644 --- a/web/app/components/workflow/nodes/trigger-schedule/components/next-execution-times.tsx +++ b/web/app/components/workflow/nodes/trigger-schedule/components/next-execution-times.tsx @@ -2,7 +2,6 @@ import React from 'react' import { useTranslation } from 'react-i18next' import type { ScheduleTriggerNodeType } from '../types' import { getFormattedExecutionTimes } from '../utils/execution-time-calculator' -import TimezoneLabel from '@/app/components/base/timezone-label' type NextExecutionTimesProps = { data: ScheduleTriggerNodeType @@ -32,8 +31,6 @@ const NextExecutionTimes = ({ data }: NextExecutionTimesProps) => { {time} - {' '} - ))} diff --git a/web/app/components/workflow/nodes/trigger-schedule/utils/execution-time-calculator.ts b/web/app/components/workflow/nodes/trigger-schedule/utils/execution-time-calculator.ts index fe5f9def1f..ff610f0e3b 100644 --- a/web/app/components/workflow/nodes/trigger-schedule/utils/execution-time-calculator.ts +++ b/web/app/components/workflow/nodes/trigger-schedule/utils/execution-time-calculator.ts @@ -1,5 +1,6 @@ import type { ScheduleTriggerNodeType } from '../types' import { isValidCronExpression, parseCronExpression } from './cron-parser' +import { convertTimezoneToOffsetStr } from '@/app/components/base/date-and-time-picker/utils/dayjs' // Get current time completely in user timezone, no browser timezone involved const getUserTimezoneCurrentTime = (timezone: string): Date => { @@ -15,7 +16,7 @@ const getUserTimezoneCurrentTime = (timezone: string): Date => { } // Format date that is already in user timezone, no timezone conversion -const formatUserTimezoneDate = (date: Date, includeWeekday: boolean = true): string => { +const formatUserTimezoneDate = (date: Date, timezone: string, includeWeekday: boolean = true): string => { const dateOptions: Intl.DateTimeFormatOptions = { year: 'numeric', month: 'long', @@ -23,7 +24,7 @@ const formatUserTimezoneDate = (date: Date, includeWeekday: boolean = true): str } if (includeWeekday) - dateOptions.weekday = 'short' + dateOptions.weekday = 'long' // Changed from 'short' to 'long' for full weekday name const timeOptions: Intl.DateTimeFormatOptions = { hour: 'numeric', @@ -31,7 +32,9 @@ const formatUserTimezoneDate = (date: Date, includeWeekday: boolean = true): str hour12: true, } - return `${date.toLocaleDateString('en-US', dateOptions)} ${date.toLocaleTimeString('en-US', timeOptions)}` + const timezoneOffset = convertTimezoneToOffsetStr(timezone) + + return `${date.toLocaleDateString('en-US', dateOptions)}, ${date.toLocaleTimeString('en-US', timeOptions)} (${timezoneOffset})` } // Helper function to get default datetime - consistent with base DatePicker @@ -230,8 +233,8 @@ export const getNextExecutionTimes = (data: ScheduleTriggerNodeType, count: numb return times } -export const formatExecutionTime = (date: Date, _timezone: string, includeWeekday: boolean = true): string => { - return formatUserTimezoneDate(date, includeWeekday) +export const formatExecutionTime = (date: Date, timezone: string, includeWeekday: boolean = true): string => { + return formatUserTimezoneDate(date, timezone, includeWeekday) } export const getFormattedExecutionTimes = (data: ScheduleTriggerNodeType, count: number = 5): string[] => {