<commit_before>import React from 'react'
import moment from 'moment'

const DatePicker = React.createClass({
  propTypes: {
    selected: React.PropTypes.object,
    onChange: React.PropTypes.func.isRequired
  },

  getDefaultProps() {
    return {
      selected: moment(),
      onChange() {}
    }
  },

  onPrevDay() {
    let newDate = this.props.selected.clone().subtract(1, 'days')
    this.props.onChange(newDate)
  },

  onNextDay() {
    let newDate = this.props.selected.clone().add(1, 'days')
    this.props.onChange(newDate)
  },

  onTodayClicked() {
    this.props.onChange(moment())
  },

  render() {
    return (
      <div>
        <div>
          <button onClick={this.onPrevDay}>Previous day</button>
          <span>{this.props.selected.format('ddd, MMM D')}</span>
          <button onClick={this.onNextDay}>Next day</button>
        </div>

        <button onClick={this.onTodayClicked}>Today</button>
      </div>
    )
  }
})

export default DatePicker<commit_msg>Rewrite DatePicker as stateless function<commit_after>import React from 'react'
import moment from 'moment'

export default function DatePicker({ selected, onChange }) {
  function onPrevDay() {
    const newDate = selected.clone().subtract(1, 'days')
    onChange(newDate)
  }

  function onNextDay() {
    const newDate = selected.clone().add(1, 'days')
    onChange(newDate)
  }

  function onTodayClicked() {
    onChange(moment())
  }

  return (
    <div>
      <div>
        <button onClick={onPrevDay}>Previous day</button>
        <span> {selected.format('ddd, MMM D')} </span>
        <button onClick={onNextDay}>Next day</button>
      </div>

      <button onClick={onTodayClicked}>Today</button>
    </div>
  )
}

DatePicker.propTypes = {
  selected: React.PropTypes.object,
  onChange: React.PropTypes.func.isRequired,
}

DatePicker.defaultProps = {
  selected: moment(),
  onChange() {},
}
{'fraction_non_alphanumeric': 0.14783526927138332, 'fraction_numerical': 0.0021119324181626186, 'mean_word_length': 3.101731601731602, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5272519', 'n_tokens_mistral': 620, 'n_tokens_neox': 610, 'n_words': 116}