Skip to content

Commit

Permalink
chore: Always add 2 chars for input size
Browse files Browse the repository at this point in the history
  • Loading branch information
zombieJ committed Nov 29, 2019
1 parent 1789f55 commit 64525a9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions examples/uncontrolled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@ export default () => (
locale={zhCN}
picker="week"
allowClear
style={{ width: 300 }}
/>
<Picker<Moment>
generateConfig={momentGenerateConfig}
locale={zhCN}
picker="week"
picker="month"
allowClear
/>
<Picker<Moment>
generateConfig={momentGenerateConfig}
locale={zhCN}
allowClear
/>
<button type="button">233</button>
Expand Down
2 changes: 1 addition & 1 deletion src/utils/uiUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export function getDefaultFormat(

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

// ====================== Mode ======================
Expand Down

0 comments on commit 64525a9

Please sign in to comment.