Skip to content

Commit

Permalink
feat: support use12hours close #151
Browse files Browse the repository at this point in the history
  • Loading branch information
BANG88 committed Dec 13, 2018
1 parent 0c26dc0 commit 19f62e1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
11 changes: 9 additions & 2 deletions components/date-picker-view/demo/basic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,24 @@ import { DatePickerView } from '../../';
export default class DatePickerViewExample extends React.Component {
state = {
value: undefined,
value12hours: undefined,
};
onChange = (value: any) => {
console.log(value);
this.setState({ value });
}
};
onValueChange = (...args: any[]) => {
console.log(args);
}
};
render() {
return (
<View>
<Text style={{ margin: 16 }}>use12Hours</Text>
<DatePickerView
value={this.state.value12hours}
onChange={v => this.setState({ value12hours: v })}
use12Hours
/>
<Text style={{ margin: 16 }}>Start DateTime</Text>
<DatePickerView
value={this.state.value}
Expand Down
3 changes: 2 additions & 1 deletion components/date-picker-view/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Properties | Descrition | Type | Default
| maxDate | maximum date | Date | 2030-1-1 |
| minuteStep | The amount of time, in minutes, between each minute item. | Number | 1 |
| locale | international, can override the configuration of the global `[LocaleProvider](https://mobile.ant.design/components/locale-provider)` | Object: {DatePickerLocale: {year, month, day, hour, minute, am?, pm?}, okText, dismissText} | - |
| disabled | 是否不可用 | Boolean | false |
| disabled | disabled | Boolean | false |
| use12Hours | 12 hours format | Boolean | false |
| onChange | change handler | (date: Object): void | - |
| onValueChange | fire when picker col change | (vals: any, index: number) => void | - |
1 change: 1 addition & 0 deletions components/date-picker-view/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ DatePickerView 的功能类似于 DatePicker ,但它是直接渲染在区域
| minuteStep | 分钟数递增步长设置 | Number | 1 |
| locale | 国际化,可覆盖全局`[LocaleProvider](https://mobile.ant.design/components/locale-provider)`的配置 | Object: {DatePickerLocale: {year, month, day, hour, minute, am?, pm?}, okText, dismissText } | - |
| disabled | 是否不可用 | Boolean | false |
| use12Hours | 12小时制 | Boolean | false |
| onChange | 时间发生变化的回调函数 | (date: Object): void | - |
| onValueChange | 每列 picker 改变时的回调 | (vals: any, index: number) => void | - |
4 changes: 2 additions & 2 deletions components/date-picker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import React from 'react';
import PickerStyles, { PickerStyle } from '../picker/style/index';
import { WithTheme, WithThemeStyles } from '../style';
import { getComponentLocale } from '../_util/getLocale';
import RCDatePicker from './datepicker';
import AntDatePicker from './datepicker';
import PopupDatePicker from './datepicker/Popup';
import { DatePickerPropsType } from './PropsType';
import { formatProps } from './utils';
Expand Down Expand Up @@ -36,7 +36,7 @@ export default class DatePicker extends React.Component<DatePickerProps> {
const { okText, dismissText, extra, DatePickerLocale } = locale;

const dataPicker = (
<RCDatePicker
<AntDatePicker
minuteStep={this.props.minuteStep}
locale={DatePickerLocale}
mode={this.props.mode}
Expand Down

0 comments on commit 19f62e1

Please sign in to comment.