Skip to content

Commit 64525a9

Browse files
committed
chore: Always add 2 chars for input size
1 parent 1789f55 commit 64525a9

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

examples/uncontrolled.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,16 @@ export default () => (
1414
locale={zhCN}
1515
picker="week"
1616
allowClear
17-
style={{ width: 300 }}
1817
/>
1918
<Picker<Moment>
2019
generateConfig={momentGenerateConfig}
2120
locale={zhCN}
22-
picker="week"
21+
picker="month"
22+
allowClear
23+
/>
24+
<Picker<Moment>
25+
generateConfig={momentGenerateConfig}
26+
locale={zhCN}
2327
allowClear
2428
/>
2529
<button type="button">233</button>

src/utils/uiUtil.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ export function getDefaultFormat(
149149

150150
export function getInputSize(picker: PickerMode | undefined, format: string) {
151151
const defaultSize = picker === 'time' ? 8 : 10;
152-
return Math.max(defaultSize, format.length);
152+
return Math.max(defaultSize, format.length) + 2;
153153
}
154154

155155
// ====================== Mode ======================

0 commit comments

Comments
 (0)