How to use react-datetime - 9 common examples

To help you get started, we’ve selected a few react-datetime examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bounswe / bounswe2018group5 / frontend / src / components / DateTimePicker / DateTimePicker.jsx View on Github external
render(){
        const { onChange, value, disabled, before } = this.props;
        // Let's use the static moment reference in the Datetime component
        var today = Datetime.moment();
        var valid = function (current) {
            if (before) {
                return current.isBefore(today);
            } else {
                return current.isAfter(today);
            }
        };
        return (
            <div>
                <br>
                
                    </div>
github ExpediaDotCom / haystack-ui / test / src / components / traces / searchBar / pickers / timeRangePicker.spec.jsx View on Github external
it('should be false when current is after today and after the ttl', () => {
        expect(TimeRangePicker.fromValid(DateTime.moment().add(1, 'day'))).to.equal(false);
    });
github ProofOfToss / proof-of-toss / src / pages / user / MyBets.js View on Github external
getStateFromQueryString(props) {
    const parsed = queryString.parse(props.location.search);

    return {
      locale: props.locale,

      categories: appConfig.categories.list,
      data: [],

      loading: true,
      error: null,

      q: parsed.q,
      fromDate: parsed.fromTimestamp ? Datetime.moment(new Date(parseInt(parsed.fromTimestamp, 10) * 1000)) : null,
      toDate: parsed.toTimestamp ? Datetime.moment(new Date(parseInt(parsed.toTimestamp, 10) * 1000)) : null,
      fromTimestamp: parsed.fromTimestamp && parseInt(parsed.fromTimestamp, 10),
      toTimestamp: parsed.toTimestamp && parseInt(parsed.toTimestamp, 10),

      pageSize: parseInt(localStorage.getItem(LOCAL_STORAGE_KEY_PLAY_PAGE_SIZE), 10) || 10,
      page: parseInt(parsed.page, 10) || 1,
      total: 0,
      sortField: parsed.sortField || 'bidSum',
      sortOrder: parsed.sortOrder || 'desc'
    };
  }
github ProofOfToss / proof-of-toss / src / components / play / Filter.js View on Github external
isValidDate(currentDate) {
    return this.props.freeDateInterval || currentDate.isSameOrAfter(Datetime.moment().add(BIDDING_END_MINUTES, 'minute'), 'day');
  }
github ProofOfToss / proof-of-toss / src / pages / play / Index.js View on Github external
return {
      locale: parsed.locale ? parsed.locale:  props.locale,

      categories: appConfig.categories.list,
      languages: appConfig.languages.list,
      data: [],

      loading: true,
      error: null,

      q: parsed.q,
      category: parsed.category ? parseInt(parsed.category, 10) : null,

      fromDate: parsed.fromTimestamp ? Datetime.moment(new Date(parseInt(parsed.fromTimestamp, 10) * 1000)) : null,
      toDate: parsed.toTimestamp ? Datetime.moment(new Date(parseInt(parsed.toTimestamp, 10) * 1000)) : null,
      fromTimestamp: parsed.fromTimestamp && parseInt(parsed.fromTimestamp, 10),
      toTimestamp: parsed.toTimestamp && parseInt(parsed.toTimestamp, 10),

      pageSize: parseInt(localStorage.getItem(LOCAL_STORAGE_KEY_PLAY_PAGE_SIZE), 10) || 10,
      page: parseInt(parsed.page, 10) || 1,
      total: 0,
      sortField: parsed.sortField || 'bidSum',
      sortOrder: parsed.sortOrder || 'desc'
    };
  }
github ProofOfToss / proof-of-toss / src / pages / user / withdraw / EventCreatorWithdraw.js View on Github external
parsed[field] = parsed['e_' + field];
      }
    });

    return {
      locale: props.locale,

      categories: appConfig.categories.list,
      data: [],

      loading: true,
      error: null,

      q: parsed.q,
      fromDate: parsed.fromTimestamp ? Datetime.moment(new Date(parseInt(parsed.fromTimestamp, 10) * 1000)) : null,
      toDate: parsed.toTimestamp ? Datetime.moment(new Date(parseInt(parsed.toTimestamp, 10) * 1000)) : null,
      fromTimestamp: parsed.fromTimestamp && parseInt(parsed.fromTimestamp, 10),
      toTimestamp: parsed.toTimestamp && parseInt(parsed.toTimestamp, 10),

      pageSize: parseInt(localStorage.getItem(LOCAL_STORAGE_KEY_PLAY_PAGE_SIZE), 10) || 10,
      page: parseInt(parsed.page, 10) || 1,
      total: 0,
      sortField: parsed.sortField || 'bidSum',
      sortOrder: parsed.sortOrder || 'desc'
    };
  }
github ProofOfToss / proof-of-toss / src / pages / play / Index.js View on Github external
const parsed = props.location && props.location.search ? queryString.parse(props.location.search) : {};

    return {
      locale: parsed.locale ? parsed.locale:  props.locale,

      categories: appConfig.categories.list,
      languages: appConfig.languages.list,
      data: [],

      loading: true,
      error: null,

      q: parsed.q,
      category: parsed.category ? parseInt(parsed.category, 10) : null,

      fromDate: parsed.fromTimestamp ? Datetime.moment(new Date(parseInt(parsed.fromTimestamp, 10) * 1000)) : null,
      toDate: parsed.toTimestamp ? Datetime.moment(new Date(parseInt(parsed.toTimestamp, 10) * 1000)) : null,
      fromTimestamp: parsed.fromTimestamp && parseInt(parsed.fromTimestamp, 10),
      toTimestamp: parsed.toTimestamp && parseInt(parsed.toTimestamp, 10),

      pageSize: parseInt(localStorage.getItem(LOCAL_STORAGE_KEY_PLAY_PAGE_SIZE), 10) || 10,
      page: parseInt(parsed.page, 10) || 1,
      total: 0,
      sortField: parsed.sortField || 'bidSum',
      sortOrder: parsed.sortOrder || 'desc'
    };
  }
github ProofOfToss / proof-of-toss / src / pages / play / Index.js View on Github external
async update() {
    const conditions = [];
    const shouldConditions = [];

    conditions.push({
      term: {
        locale: this.state.locale
      }
    });

    if(this.props.routeName !== 'admin/event_results') {
      conditions.push({
        range: {
          startDate: {
            gte: parseInt(Datetime.moment().add(BIDDING_END_MINUTES, 'minute').unix(), 10),
          }
        }
      });
    }

    if (this.state.q) {
      shouldConditions.push({
        query_string: {
          analyzer: getLanguageAnalyzerByCode(this.props.locale),
          fields: ['name', 'description'],
          query: this.state.q
        }
      });

      shouldConditions.push({
        "nested": {

react-datetime

A lightweight but complete datetime picker React.js component

MIT
Latest version published 2 years ago

Package Health Score

62 / 100
Full package analysis

Popular react-datetime functions