diff --git a/README.md b/README.md index 867e40d95..66d617dac 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,7 @@ Below we have all the props that we can use with the `` component. The | **dateFormat** | `boolean` or `string` | `true` | Defines the format for the date. It accepts any [Moment.js date format](http://momentjs.com/docs/#/displaying/format/) (not in localized format). If `true` the date will be displayed using the defaults for the current locale. If `false` the datepicker is disabled and the component can be used as timepicker, see [available units docs](#specify-available-units). | | **timeFormat** | `boolean` or `string` | `true` | Defines the format for the time. It accepts any [Moment.js time format](http://momentjs.com/docs/#/displaying/format/) (not in localized format). If `true` the time will be displayed using the defaults for the current locale. If `false` the timepicker is disabled and the component can be used as datepicker, see [available units docs](#specify-available-units). | | **input** | `boolean` | `true` | Whether to show an input field to edit the date manually. | +| **position** | `string` | `down` | Whether to show the picker above or below the input feild. `up` to show above the input feild. | | **open** | `boolean` | `null` | Whether to open or close the picker. If not set react-datetime will open the datepicker on input focus and close it on click outside. | | **locale** | `string` | `null` | Manually set the locale for the react-datetime instance. Moment.js locale needs to be loaded to be used, see [i18n docs](#i18n). | **utc** | `boolean` | `false` | When true, input time values will be interpreted as UTC (Zulu time) by Moment.js. Otherwise they will default to the user's local timezone. diff --git a/css/react-datetime.css b/css/react-datetime.css index 9c428e1d1..3fefcb957 100644 --- a/css/react-datetime.css +++ b/css/react-datetime.css @@ -16,6 +16,10 @@ box-shadow: 0 1px 3px rgba(0,0,0,.1); border: 1px solid #f9f9f9; } +.rdtUp{ + position: absolute; + top: -306px; +} .rdtOpen .rdtPicker { display: block; } diff --git a/src/DateTime.js b/src/DateTime.js index 88a72bfb0..90ed0ce6b 100644 --- a/src/DateTime.js +++ b/src/DateTime.js @@ -89,13 +89,23 @@ export default class Datetime extends React.Component { return ( { this.renderInput() } -
+
{ this.renderView() }
); } + getClassNames() { + let defaultClassName='rdtPicker'; + if (this.props.position) { + const mPosition=this.props.position.toLowerCase(); + if (mPosition==='up') return defaultClassName+' rdtUp'; + return defaultClassName; + } + return defaultClassName; + } + renderInput() { if ( !this.props.input ) return; diff --git a/src/playground/App.js b/src/playground/App.js index 2673b5f9f..7c8b37e20 100644 --- a/src/playground/App.js +++ b/src/playground/App.js @@ -14,8 +14,8 @@ class App extends React.Component { render() { return ( -
- +
+
); }