<commit_before>import React, {PropTypes, Component} from 'react'
import rome from 'rome'
import moment from 'moment'

class CustomTimeRange extends Component {
  constructor(props) {
    super(props)

    this.handleClick = ::this.handleClick
    this._formatTimeRange = ::this._formatTimeRange
  }

  componentDidMount() {
    const {timeRange} = this.props

    const lower = rome(this.lower, {
      initialValue: this._formatTimeRange(timeRange.lower),
    })
    const upper = rome(this.upper, {
      initialValue: this._formatTimeRange(timeRange.upper),
    })

    this.lowerCal = lower
    this.upperCal = upper
  }

  // If there is an upper or lower time range set, set the corresponding calendar's value.
  componentWillReceiveProps(nextProps) {
    const {lower, upper} = nextProps.timeRange
    if (lower) {
      this.lowerCal.setValue(this._formatTimeRange(lower))
    }

    if (upper) {
      this.upperCal.setValue(this._formatTimeRange(upper))
    }
  }

  render() {
    return (
      <div className="custom-time--container">
        <div className="custom-time--dates">
          <div className="custom-time--lower" ref={r => (this.lower = r)} />
          <div className="custom-time--upper" ref={r => (this.upper = r)} />
        </div>
        <div
          className="custom-time--apply btn btn-sm btn-primary"
          onClick={this.handleClick}
        >
          Apply
        </div>
      </div>
    )
  }

  /*
   * Upper and lower time ranges are passed in with single quotes as part of
   * the string literal, i.e. "'2015-09-23T18:00:00.000Z'".  Remove them
   * before passing the string to be parsed.<commit_msg>Remove CustomTimeRange container class in split, but this damages styles due to selectors.<commit_after>import React, {PropTypes, Component} from 'react'
import rome from 'rome'
import moment from 'moment'

class CustomTimeRange extends Component {
  constructor(props) {
    super(props)

    this.handleClick = ::this.handleClick
    this._formatTimeRange = ::this._formatTimeRange
  }

  componentDidMount() {
    const {timeRange} = this.props

    const lower = rome(this.lower, {
      initialValue: this._formatTimeRange(timeRange.lower),
    })
    const upper = rome(this.upper, {
      initialValue: this._formatTimeRange(timeRange.upper),
    })

    this.lowerCal = lower
    this.upperCal = upper
  }

  // If there is an upper or lower time range set, set the corresponding calendar's value.
  componentWillReceiveProps(nextProps) {
    const {lower, upper} = nextProps.timeRange
    if (lower) {
      this.lowerCal.setValue(this._formatTimeRange(lower))
    }

    if (upper) {
      this.upperCal.setValue(this._formatTimeRange(upper))
    }
  }

  render() {
    return (
      <div>
        <div className="custom-time--dates">
          <div className="custom-time--lower" ref={r => (this.lower = r)} />
          <div className="custom-time--upper" ref={r => (this.upper = r)} />
        </div>
        <div
          className="custom-time--apply btn btn-sm btn-primary"
          onClick={this.handleClick}
        >
          Apply
        </div>
      </div>
    )
  }

  /*
   * Upper and lower time ranges are passed in with single quotes as part of
   * the string literal, i.e. "'2015-09-23T18:00:00.000Z'".  Remove them
   * before passing the string to be parsed.
{'fraction_non_alphanumeric': 0.12074118350268978, 'fraction_numerical': 0.010161386730424387, 'mean_word_length': 2.686123348017621, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 23, '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': '1359148', 'n_tokens_mistral': 1031, 'n_tokens_neox': 996, 'n_words': 254}