Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/basic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class BasicDemo extends React.Component<{}, {
{this.renderBtn('选择日期时间区间', 'Select DateTime Range', { pickTime: true })}
{this.renderBtn('选择日期', 'Select Date', { type: 'one' })}
{this.renderBtn('选择日期时间', 'Select DateTime', { type: 'one', pickTime: true })}
{this.renderBtn('选择日期时间(24小时制)', 'Select DateTime', { type: 'one', pickTime: true, use12Hours: false })}
{this.renderBtn('选择日期区间(快捷)', 'Select Date Range (Shortcut)', { showShortcut: true })}
{this.renderBtn('选择日期时间区间(快捷)', 'Select DateTime Range (Shortcut)', { pickTime: true, showShortcut: true })}
{this.renderBtn('水平进入', 'Horizontal Enter Aniamtion', { enterDirection: 'horizontal' })}
Expand Down
4 changes: 3 additions & 1 deletion src/Calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export default class Calendar extends React.PureComponent<PropsType, StateType>
prefixCls: 'rmc-calendar',
type: 'range',
defaultTimeValue: new Date(2000, 0, 1, 8),
use12Hours: true
} as PropsType;

constructor(props: PropsType) {
Expand Down Expand Up @@ -191,7 +192,7 @@ export default class Calendar extends React.PureComponent<PropsType, StateType>
type, locale = {} as Models.Locale, prefixCls, visible, pickTime, showShortcut, renderHeader,
infiniteOpt, initalMonths, defaultDate, minDate, maxDate, getDateExtra, rowSize,
defaultTimeValue, renderShortcut, enterDirection, timePickerPrefixCls, timePickerPickerPrefixCls,
style,
style, use12Hours
} = this.props;
const {
showTimePicker, timePickerTitle,
Expand Down Expand Up @@ -247,6 +248,7 @@ export default class Calendar extends React.PureComponent<PropsType, StateType>
minDate={minDate}
maxDate={maxDate}
clientHeight={clientHight}
use12Hours={use12Hours}
/>
}
{
Expand Down
1 change: 1 addition & 0 deletions src/CalendarProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,5 @@ export default interface PropsType {
defaultTimeValue?: Date;
timePickerPrefixCls?: string;
timePickerPickerPrefixCls?: string;
use12Hours?: boolean;
}
6 changes: 3 additions & 3 deletions src/TimePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ export interface PropsType {
defaultValue?: Date;
value?: Date;
onValueChange?: (time: Date) => void;

minDate?: Date;
maxDate?: Date;
clientHeight?: number;
use12Hours?: boolean;
}
export interface StateType {
}
Expand Down Expand Up @@ -54,7 +54,7 @@ export default class TimePicker extends React.PureComponent<PropsType, StateType
}

render() {
const { locale, title, value, defaultValue, prefixCls, pickerPrefixCls, clientHeight } = this.props;
const { locale, title, value, defaultValue, prefixCls, pickerPrefixCls, clientHeight, use12Hours } = this.props;
const date = value || defaultValue || undefined;
const height = (clientHeight && clientHeight * 3 / 8 - 52) || Number.POSITIVE_INFINITY;

Expand All @@ -74,7 +74,7 @@ export default class TimePicker extends React.PureComponent<PropsType, StateType
minDate={this.getMinTime(date)}
maxDate={this.getMaxTime(date)}
onDateChange={this.onDateChange}
use12Hours
use12Hours={use12Hours}
/>
</div>
);
Expand Down