marquex
2015-06-19 4ad788357a6e7d4c75861498de98d94e8c1e69e8
Completely separate the fork from react-bootstrap-datetimepicker
1 files deleted
1 files modified
5 files renamed
105 ■■■■ changed files
src/Constants.jsx 5 ●●●●● patch | view | raw | blame | history
src/DateTime.jsx 43 ●●●●● patch | view | raw | blame | history
src/DaysView.jsx patch | view | raw | blame | history
src/MonthsView.jsx patch | view | raw | blame | history
src/TimeView.jsx 55 ●●●● patch | view | raw | blame | history
src/YearsView.jsx patch | view | raw | blame | history
webpack.config.js 2 ●●● patch | view | raw | blame | history
src/Constants.jsx
File was deleted
src/DateTime.jsx
File was renamed from src/DateTimeField.jsx
@@ -1,16 +1,19 @@
'use strict';
var assign = require('object-assign'),
React = require('react'),
DaysView = require('./DateTimePickerDays'),
MonthsView = require('./DateTimePickerMonths'),
YearsView = require('./DateTimePickerYears'),
TimeView = require('./DateTimePickerTime'),
moment = require('moment'),
Constants = require('./Constants')
    React = require('react'),
    DaysView = require('./DaysView'),
    MonthsView = require('./MonthsView'),
    YearsView = require('./YearsView'),
    TimeView = require('./TimeView'),
    moment = require('moment')
;
var noop = function(){};
var Constants = {
    MODE_DATE: 'date',
    MODE_DATETIME: 'datetime',
    MODE_TIME: 'time'
};
var DateTimeField = React.createClass({
    mixins: [
@@ -67,10 +70,6 @@
            selectedDate: moment(date),
            inputValue: typeof this.props.defaultText != 'undefined' ?  this.props.defaultText : moment(date).format( formats.datetime )
        };
    },
    getFormat: function( props ){
        return this.getFormats( props ).datetime;
    },
    getFormats: function( props ){
@@ -136,7 +135,7 @@
        return this.setState({
            inputValue: value
        }, function() {
            return this.props.onChange(moment(this.state.inputValue, this.state.inputFormat, true).format( this.getFormat( this.props )));
            return this.props.onChange(moment(this.state.inputValue, this.state.inputFormat, true).format( this.state.inputFormat ));
        });
    },
@@ -149,10 +148,10 @@
    setDate: function( type ){
        var me = this,
        nextViews = {
            month: 'days',
            year: 'months'
        }
            nextViews = {
                month: 'days',
                year: 'months'
            }
        ;
        return function( e ){
            me.setState({
@@ -189,16 +188,22 @@
            nextType
        ;
        // It is needed to set all the time properties
        // to not to reset the time
        date[ type ]( value );
        for (; index < this.allowedSetTime.length; index++) {
            nextType = this.allowedSetTime[index];
            date[ nextType ]( date[nextType]() );
        }
        this.setState({ selectedDate: date, inputValue: date.format( this.state.inputFormat ) }, this.callOnChange );
        this.setState({
            selectedDate: date,
            inputValue: date.format( this.state.inputFormat )
        }, this.callOnChange );
    },
    callOnChange: function(){
        this.props.onChange(this.state.selectedDate.format( this.getFormat( this.props )));
        this.props.onChange(this.state.selectedDate.format( this.state.inputFormat ));
    },
    updateDate: function( e ) {
src/DaysView.jsx
src/MonthsView.jsx
src/TimeView.jsx
File was renamed from src/DateTimePickerTime.jsx
@@ -1,10 +1,8 @@
var DateTimePickerHours, React;
'use strict';
React = require('react');
var React = require('react');
var Constants = require('./Constants');
DateTimePickerTime = React.createClass({
var DateTimePickerTime = React.createClass({
    getInitialState: function(){
        var date = this.props.selectedDate,
            format = this.props.timeFormat,
@@ -64,47 +62,6 @@
           </div>
        </div>
      );
    return (
      <div className="timepicker">
           <div className="timepicker-picker">
             <table className="table-condensed">
                 { this.renderHeader() }
               <tbody>
                 <tr>
                   <td><a className="btn" onClick={this.props.addTime(1, 'hours', true)}>&#x25B2;</a></td>
                   <td className="separator"></td>
                   <td><a className="btn" onClick={this.props.addTime(1, 'minutes', true)}>&#x25B2;</a></td>
                   <td className="separator"></td>
                 </tr>
                 <tr>
                   <td><span className="timepicker-hour">{this.props.selectedDate.format('H')}</span></td>
                   <td className="separator">:</td>
                   <td><span className="timepicker-minute">{this.props.selectedDate.format('mm')}</span></td>
                   <td className="separator"></td>
                 </tr>
                 <tr>
                   <td><a className="btn" onClick={this.props.subtractTime( 1, 'hours', true )}>&#x25BC;</a></td>
                   <td className="separator"></td>
                   <td><a className="btn" onClick={this.props.subtractTime( 1, 'minutes', true )}>&#x25BC;</a></td>
                   <td className="separator"></td>
                 </tr>
               </tbody>
             </table>
           </div>
      </div>
   );
  },
  renderHeader: function(){
      if( !this.props.dateFormat )
@@ -148,17 +105,17 @@
    padValues: {
        hours: 1,
        minutes: 2,
        minutes: 2,
        seconds: 2,
        milliseconds: 3
    },
    increase: function( type ){
        value = parseInt(this.state[ type ]) + 1;
        var value = parseInt(this.state[ type ]) + 1;
        if( value > this.maxValues[ type ] )
            value = 0;
        return this.pad( type, value );
    },
    decrease: function( type ){
        value = parseInt(this.state[ type ]) - 1;
        var value = parseInt(this.state[ type ]) - 1;
        if( value < 0 )
            value = this.maxValues[ type ];
        return this.pad( type, value );
src/YearsView.jsx
webpack.config.js
@@ -18,7 +18,7 @@
module.exports = {
  entry: ['./src/DateTimeField.jsx'],
  entry: ['./src/DateTime.jsx'],
  output: {
    path: __dirname + "/dist/",