diff --git a/components/date-picker/RangePicker.tsx b/components/date-picker/RangePicker.tsx index 5ce2cf9ed7..85ed4a02f0 100644 --- a/components/date-picker/RangePicker.tsx +++ b/components/date-picker/RangePicker.tsx @@ -165,7 +165,7 @@ export default class RangePicker extends React.Component { // default width for showTime const pickerStyle = {} as any; if (props.showTime) { - pickerStyle.width = style.width || 300; + pickerStyle.width = (style && style.width) || 300; } const clearIcon = (!props.disabled && props.allowClear && value && (value[0] || value[1])) diff --git a/components/date-picker/__tests__/__snapshots__/demo.test.js.snap b/components/date-picker/__tests__/__snapshots__/demo.test.js.snap index de0f789ca9..084dfc4398 100644 --- a/components/date-picker/__tests__/__snapshots__/demo.test.js.snap +++ b/components/date-picker/__tests__/__snapshots__/demo.test.js.snap @@ -127,7 +127,7 @@ exports[`test renders ./components/date-picker/demo/disabled-date.md correctly 1
+ style="width:300px;"> + style="width:300px;"> + style="width:300px;"> + style="width:300px;">