From 43470825f261d92a2c9feaebea5cda04c17757d4 Mon Sep 17 00:00:00 2001 From: Deepak Jose Date: Wed, 30 Oct 2024 12:47:06 +0530 Subject: [PATCH 1/2] Added getNow to the PickerProps type definition. --- src/PickerInput/SinglePicker.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/PickerInput/SinglePicker.tsx b/src/PickerInput/SinglePicker.tsx index 9fe862d84..11af70f28 100644 --- a/src/PickerInput/SinglePicker.tsx +++ b/src/PickerInput/SinglePicker.tsx @@ -99,7 +99,9 @@ export interface BasePickerProps export interface PickerProps extends BasePickerProps, - Omit, 'format' | 'defaultValue'> {} + Omit, 'format' | 'defaultValue'> { + getNow?: () => string; +} /** Internal usage. For cross function get same aligned props */ export type ReplacedPickerProps = { From 7e6ed315500c6235de725e6bcba7b086b7217aee Mon Sep 17 00:00:00 2001 From: Deepak Jose Date: Wed, 30 Oct 2024 12:56:41 +0530 Subject: [PATCH 2/2] Replaces the getNow in the generateConfig with the getNow from props if present to fix the timezone issues. --- src/PickerInput/hooks/useFilledProps.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/PickerInput/hooks/useFilledProps.ts b/src/PickerInput/hooks/useFilledProps.ts index 5b562f61c..3da44ddd4 100644 --- a/src/PickerInput/hooks/useFilledProps.ts +++ b/src/PickerInput/hooks/useFilledProps.ts @@ -41,6 +41,7 @@ type PickedProps = Pick< defaultValue?: any; pickerValue?: any; defaultPickerValue?: any; + getNow?: () => string; }; type ExcludeBooleanType = T extends boolean ? never : T; @@ -161,6 +162,10 @@ export default function useFilledProps< const filledProps = React.useMemo( () => ({ ...props, + generateConfig: { + ...generateConfig, + getNow: props.getNow || props.generateConfig.getNow, + }, prefixCls, locale: mergedLocale, picker,