<commit_before>import React                          from 'react';
import { localize }                   from '_common/localize';
import { toMoment }                   from 'Utils/Date';

function selectOption(type, value, props, is_enabled = true) {
    if (is_enabled && props.value) {
        const [ prev_hour, prev_minute ] = props.value.split(':');
        if ((type === 'h' && value !== prev_hour) || (type === 'm' && value !== prev_minute)) {
            props.onChange(`${type === 'h' ? value : prev_hour}:${type === 'm' ? value : prev_minute}`);
        }
    }
}

function TimePickerDropdown(props) {
    const hours    = [...Array(24).keys()].map((a)=>`0${a}`.slice(-2));
    const minutes  = [...Array(12).keys()].map((a)=>`0${a * 5}`.slice(-2));

    const { preClass, value, start_time, end_time } = props;
    const start_time_moment     = start_time ? toMoment(start_time) : toMoment();
    const end_time_moment       = end_time ? toMoment(end_time) : toMoment().hour('23').minute('59').seconds('59').milliseconds('999');
    const to_compare_moment     = toMoment();
    const [ hour, minute ]      = value.split(':');
    return (
        <div className={`${preClass}-dropdown ${props.className}`}>
            <div className={`${preClass}-selector`}>
                <div className={`${preClass}-hours`}>
                    <div className='list-title center-text'><strong>{localize('Hour')}</strong></div>
                    <div className='list-container'>
                        {hours.map((h, key) => {
                            to_compare_moment.hour(h);
                            const is_enabled = to_compare_moment.isBetween(start_time_moment, end_time_moment);
                            return (
                                <div
                                    className={`list-item${hour === h ? ' selected' : ''}${is_enabled ? '' : ' disabled'}`}
                                    key={key}
                                    onClick={() => { selectOption('h', h, props, is_enabled); }}
                                >
                                    {h}
                                </div>
                            );<commit_msg>Code Improvement : Minor line change<commit_after>import React                          from 'react';
import { localize }                   from '_common/localize';
import { toMoment }                   from 'Utils/Date';

function selectOption(type, value, props, is_enabled = true) {
    if (is_enabled && props.value) {
        const [ prev_hour, prev_minute ] = props.value.split(':');
        if ((type === 'h' && value !== prev_hour) || (type === 'm' && value !== prev_minute)) {
            props.onChange(`${type === 'h' ? value : prev_hour}:${type === 'm' ? value : prev_minute}`);
        }
    }
}

function TimePickerDropdown(props) {
    const { preClass, value, start_time, end_time } = props;
    const start_time_moment     = start_time ? toMoment(start_time) : toMoment();
    const end_time_moment       = end_time ? toMoment(end_time) : toMoment().hour('23').minute('59').seconds('59').milliseconds('999');
    const to_compare_moment     = toMoment();
    const [ hour, minute ]      = value.split(':');
    const hours    = [...Array(24).keys()].map((a)=>`0${a}`.slice(-2));
    const minutes  = [...Array(12).keys()].map((a)=>`0${a * 5}`.slice(-2));
    return (
        <div className={`${preClass}-dropdown ${props.className}`}>
            <div className={`${preClass}-selector`}>
                <div className={`${preClass}-hours`}>
                    <div className='list-title center-text'><strong>{localize('Hour')}</strong></div>
                    <div className='list-container'>
                        {hours.map((h, key) => {
                            to_compare_moment.hour(h);
                            const is_enabled = to_compare_moment.isBetween(start_time_moment, end_time_moment);
                            return (
                                <div
                                    className={`list-item${hour === h ? ' selected' : ''}${is_enabled ? '' : ' disabled'}`}
                                    key={key}
                                    onClick={() => { selectOption('h', h, props, is_enabled); }}
                                >
                                    {h}
                                </div>
                            );
{'fraction_non_alphanumeric': 0.16401996370235936, 'fraction_numerical': 0.008166969147005444, 'mean_word_length': 1.6672716273442225, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '19539', 'n_tokens_mistral': 1244, 'n_tokens_neox': 1203, 'n_words': 220}