<commit_before>var React = require('react');
var moment = require('moment');

var DateSpan =  React.createClass({
    propTypes: {
        date: React.PropTypes.oneOfType([
            React.PropTypes.number,
            React.PropTypes.string,
            React.PropTypes.instanceOf(Date)
        ]).isRequired,

        refreshInterval: React.PropTypes.number,
        format:          React.PropTypes.string
    },

    getDefaultProps: function() {
        return {
            refreshInterval: 10*1000,
            format:          ''
        };
    },

    getInitialState: function() {
        return {
            currentDate: Date.now()
        };
    },

    tick: function() {
        this.setState({
            currentDate: Date.now()
        });
    },

    componentDidMount: function() {
        this.interval = setInterval(this.tick, this.props.refreshInterval);
    },

    componentWillUnmount: function() {
        clearInterval(this.interval);
    },

    render: function() {
        var date   = this.props.date;
        var format = this.props.format;

        // Display interval by default
        var displayDate = moment(date).fromNow();<commit_msg>Don't refresh DateSpan when format prop is passed<commit_after>var React = require('react');
var moment = require('moment');

var DateSpan =  React.createClass({
    propTypes: {
        date: React.PropTypes.oneOfType([
            React.PropTypes.number,
            React.PropTypes.string,
            React.PropTypes.instanceOf(Date)
        ]).isRequired,

        refreshInterval: React.PropTypes.number,
        format:          React.PropTypes.string
    },

    getDefaultProps: function() {
        return {
            format:          '',
            refreshInterval: 10*1000
        };
    },

    getInitialState: function() {
        return {
            currentDate: Date.now()
        };
    },

    tick: function() {
        this.setState({
            currentDate: Date.now()
        });
    },

    componentDidMount: function() {
        if (!this.props.format) {
            this.interval = setInterval(this.tick, this.props.refreshInterval);
        }
    },

    componentWillUnmount: function() {
        if (!this.props.format) {
            clearInterval(this.interval);
        }
    },

    render: function() {
        var date   = this.props.date;
        var format = this.props.format;

        // Display interval by default
        var displayDate = moment(date).fromNow();
{'fraction_non_alphanumeric': 0.11786001609010459, 'fraction_numerical': 0.004827031375703942, 'mean_word_length': 1.8390410958904109, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1716055', 'n_tokens_mistral': 686, 'n_tokens_neox': 669, 'n_words': 128}