fix: pass user timezone from app context to the date picker component. (#31831)

Co-authored-by: yyh <92089059+lyzno1@users.noreply.github.com>
This commit is contained in:
GuanMu
2026-02-09 14:10:24 +08:00
committed by GitHub
parent 5b06203ef5
commit 6c63c6a221
2 changed files with 4 additions and 2 deletions

View File

@@ -7,6 +7,7 @@ import dayjs from 'dayjs'
import { useCallback } from 'react'
import { useTranslation } from 'react-i18next'
import DatePicker from '@/app/components/base/date-and-time-picker/date-picker'
import { useAppContext } from '@/context/app-context'
import useTimestamp from '@/hooks/use-timestamp'
import { cn } from '@/utils/classnames'
@@ -21,7 +22,7 @@ const WrappedDatePicker = ({
onChange,
}: Props) => {
const { t } = useTranslation()
// const { userProfile: { timezone } } = useAppContext()
const { userProfile: { timezone } } = useAppContext()
const { formatTime: formatTimestamp } = useTimestamp()
const handleDateChange = useCallback((date?: dayjs.Dayjs) => {
@@ -64,6 +65,7 @@ const WrappedDatePicker = ({
return (
<DatePicker
value={dayjs(value ? value * 1000 : Date.now())}
timezone={timezone}
onChange={handleDateChange}
onClear={handleDateChange}
renderTrigger={renderTrigger}

View File

@@ -309,7 +309,7 @@ describe('WorkflowToolConfigureButton', () => {
it('should render loading state when published and fetching details', async () => {
// Arrange
mockFetchWorkflowToolDetailByAppID.mockImplementation(() => new Promise(() => {})) // Never resolves
mockFetchWorkflowToolDetailByAppID.mockImplementation(() => new Promise(() => { })) // Never resolves
const props = createDefaultConfigureButtonProps({ published: true })
// Act