<commit_before>import React from 'react';
import moment from 'moment';
import InputField from './form/input_field.jsx';
import Datepicker from './form/date_picker.jsx';
import Dropdown from './form/dropdown.jsx';
import Fieldset from './elements/fieldset.jsx';
import TimePicker from './form/time_picker.jsx';
import { connect } from '../store/connect';
import { localize } from '../../../../_common/localize';

const expiry_list = [
    { text: localize('Duration'), value: 'duration' },
    { text: localize('End Time'), value: 'endtime' },
];

let min_date_duration,
    max_date_duration,
    min_date_expiry;

const Duration = ({
    expiry_type,
    expiry_time,
    duration,
    duration_unit,
    duration_units_list,
    server_time,
    onChange,
    is_nativepicker,
    is_minimized,
}) => {
    const moment_now = moment(server_time);
    if (!min_date_expiry || moment_now.date() !== min_date_expiry.date()) {
        min_date_duration = moment_now.clone().add(1, 'd');
        max_date_duration = moment_now.clone().add(365, 'd');
        min_date_expiry   = moment_now.clone();
    }
    if (is_minimized) {
        return (
            <div>Duration: {duration}</div>
        );
    }
    return (
        <Fieldset
            time={server_time}
            header={localize('Trade Duration')}
            icon='trade-duration'
            tooltip={localize('Text for Duration goes here.')}
        >
            <Dropdown
                list={expiry_list}
                value={expiry_type}
                name='expiry_type'
                onChange={onChange}
                is_nativepicker={is_nativepicker}
            />

            {expiry_type === 'duration' ?
                <React.Fragment>
                    <div className='duration-container'>
                        {duration_unit === 'd' ?
                            <Datepicker
                                name='duration'
                                minDate={min_date_duration}
                                maxDate={max_date_duration}
                                displayFormat='d'
                                onChange={onChange}
                                is_nativepicker={is_nativepicker}
                            /> :
                            <InputField
                                type='number'
                                name='duration'
                                value={duration}<commit_msg>dont use datepicker on mobile for duration days<commit_after>import React from 'react';
import moment from 'moment';
import InputField from './form/input_field.jsx';
import Datepicker from './form/date_picker.jsx';
import Dropdown from './form/dropdown.jsx';
import Fieldset from './elements/fieldset.jsx';
import TimePicker from './form/time_picker.jsx';
import { connect } from '../store/connect';
import { localize } from '../../../../_common/localize';

const expiry_list = [
    { text: localize('Duration'), value: 'duration' },
    { text: localize('End Time'), value: 'endtime' },
];

let min_date_duration,
    max_date_duration,
    min_date_expiry;

const Duration = ({
    expiry_type,
    expiry_time,
    duration,
    duration_unit,
    duration_units_list,
    server_time,
    onChange,
    is_nativepicker,
    is_minimized,
}) => {
    const moment_now = moment(server_time);
    if (!min_date_expiry || moment_now.date() !== min_date_expiry.date()) {
        min_date_duration = moment_now.clone().add(1, 'd');
        max_date_duration = moment_now.clone().add(365, 'd');
        min_date_expiry   = moment_now.clone();
    }
    if (is_minimized) {
        return (
            <div>Duration: {duration} {duration_unit}</div>
        );
    }
    return (
        <Fieldset
            time={server_time}
            header={localize('Trade Duration')}
            icon='trade-duration'
            tooltip={localize('Text for Duration goes here.')}
        >
            <Dropdown
                list={expiry_list}
                value={expiry_type}
                name='expiry_type'
                onChange={onChange}
                is_nativepicker={is_nativepicker}
            />

            {expiry_type === 'duration' ?
                <React.Fragment>
                    <div className='duration-container'>
                        {duration_unit === 'd' && !is_nativepicker ?
                            <Datepicker
                                name='duration'
                                minDate={min_date_duration}
                                maxDate={max_date_duration}
                                displayFormat='d'
                                onChange={onChange}
                                is_nativepicker={is_nativepicker}
                            /> :
                            <InputField
                                type='number'
                                name='duration'
                                value={duration}
{'fraction_non_alphanumeric': 0.11401377075739165, 'fraction_numerical': 0.0016200891049007696, 'mean_word_length': 1.5845107273678702, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, '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': '6437536', 'n_tokens_mistral': 1371, 'n_tokens_neox': 1305, 'n_words': 242}