Co-authored-by: pointhalo <[email protected]>
@@ -213,14 +213,14 @@ class TimePickerFoundation<P = Record<string, any>, S = Record<string, any>> ext
)
);
}
- const inputValue = this.formatValue(dates);
-
- this.setState({
- value: dates,
- invalid,
- inputValue,
- } as any);
+ const inputValue = this.formatValue(dates);
+
+ this.setState({
+ value: dates,
+ invalid,
+ inputValue,
+ } as any);
handleFocus(e: any) {
@@ -25,6 +25,8 @@ export const parseToDate = (input: string | Date | number, formatToken = strings
// console.log(curDate, formatToken);
return curDate;
+ } else if (typeof input === 'undefined') {
+ return undefined;
return new Date();
@@ -311,4 +311,28 @@ export const Fix1604 = () => {
Fix1604.story = {
name: 'Fix Time Zone',
+};
+export const Fix1716 = () => {
+ const [v, setV] = useState([]);
+ const handleChange = (value) => {
+ console.log(value);
+ setV(value);
+ }
+ return (
+ <div>
+ <h4>非受控的timepicker,正常</h4>
+ <TimePicker type="timeRange" />
+ <h4>受控的timepicker,修改后正常</h4>
+ <TimePicker
+ type="timeRange"
+ value={v}
+ onChange={handleChange}
+ />
+ </div>
+ );
+Fix1716.story = {
+ name: 'Fix 1716',
};