Skip to content

Change DateTimeFormat type to func and add cancelLabel #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
18 changes: 11 additions & 7 deletions src/DateTimePicker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ export default class DateTimePicker extends Component {
DatePicker: PropTypes.func.isRequired,
TimePicker: PropTypes.func.isRequired,

DateTimeFormat: PropTypes.object,
DateTimeFormat: PropTypes.func,
locale: PropTypes.string,

format: PropTypes.string,
timePickerDelay: PropTypes.number,
okLabel: PropTypes.string,
cancelLabel: PropTypes.string,
name: PropTypes.string,
showCurrentDateByDefault: PropTypes.bool,
returnMomentDate: PropTypes.bool,
Expand Down Expand Up @@ -68,6 +69,7 @@ export default class DateTimePicker extends Component {
static defaultProps = {
customValue: undefined,
okLabel: 'OK',
cancelLabel: 'Cancel',
minDate: undefined,
maxDate: undefined,
name: 'datepicker',
Expand Down Expand Up @@ -207,7 +209,7 @@ export default class DateTimePicker extends Component {
firstDayOfWeek, textFieldClassName, autoOkDatePicker,
datePickerMode, disableYearSelection, shouldDisableDate,
hideCalendarDate, openToYearSelection, timePickerBodyStyle,
okLabel, autoOkTimePicker, timePickerDialogStyle, clearIconStyle, style, textFieldStyle,
cancelLabel, okLabel, autoOkTimePicker, timePickerDialogStyle, clearIconStyle, style, textFieldStyle,
minutesStep,
timePickerDelay,
showCurrentDateByDefault,
Expand All @@ -226,13 +228,13 @@ export default class DateTimePicker extends Component {
} = this.props;

return (
<div style={{ ...styles.container, style }} className={this.props.className}>
<div style={Object.assign({}, styles.container, style)} className={this.props.className}>
<TextField
onFocus={this.handleFocus}
className={textFieldClassName}
onClick={this.openDatePicker}
value={this.getDisplayTime()}
style={{ ...styles.textField, ...textFieldStyle }}
style={Object.assign({}, styles.textField, textFieldStyle)}
disabled={disabled}
{...other}
/>
Expand All @@ -241,7 +243,7 @@ export default class DateTimePicker extends Component {
clearIcon
? <IconButton
onClick={this.clearState}
style={{ ...styles.clearIcon, ...clearIconStyle }}
style={Object.assign({}, styles.clearIcon, clearIconStyle)}
disabled={disabled}>
{ clearIcon }
</IconButton>
Expand All @@ -253,6 +255,7 @@ export default class DateTimePicker extends Component {
initialDate={this.getDateOrCurrentTime()}
maxDate={this.getDateOrNull(maxDate)}
minDate={this.getDateOrNull(minDate)}
cancelLabel={cancelLabel}
okLabel={okLabel}
autoOk={autoOkDatePicker}
firstDayOfWeek={firstDayOfWeek}
Expand All @@ -264,8 +267,8 @@ export default class DateTimePicker extends Component {
shouldDisableDate={shouldDisableDate}
hideCalendarDate={hideCalendarDate}
openToYearSelection={openToYearSelection}
DateTimeFormat = { DateTimeFormat }
locale = { locale }
DateTimeFormat = {DateTimeFormat}
locale = {locale}
/>

<TimePicker
Expand All @@ -275,6 +278,7 @@ export default class DateTimePicker extends Component {
bodyStyle={timePickerBodyStyle}
onShow={onTimePickerShow}
format={timeFormat}
cancelLabel={cancelLabel}
okLabel={okLabel}
autoOk={autoOkTimePicker}
style={timePickerDialogStyle}
Expand Down