How to use the react-widgets/lib/localizers/moment function in react-widgets

To help you get started, we’ve selected a few react-widgets 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 redux-autoform / redux-autoform / demo / components / LiveSchemaEditor.js View on Github external
render() {

        // setting date localizer
        reactWidgetsMomentLocalizer(moment);
        momentLocalizer(moment);

        // setting number localizer
        numbroLocalizer(numbro);

        let {
            reduxFormActions,
            preset,
            metaForm,
            formOptions,
            formOptionsActions
        } = this.props;

        preset = preset || 'default';
        let presetObject = _.find(presets, p => p.name == preset);
        if (!presetObject) throw Error(`Could not find preset. Preset name: ${preset}`);
github foxhound87 / mobx-react-form / demo / src / main.jsx View on Github external
import React from 'react';
import { render } from 'react-dom';
import moment from 'moment';
import injectTapEventPlugin from 'react-tap-event-plugin';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
import momentLocalizer from 'react-widgets/lib/localizers/moment';

import 'react-widgets/lib/less/react-widgets.less';
import 'react-select/dist/react-select.css';

import './style.css';
import './style.devtools.css';

import Main from './components/Main';

momentLocalizer(moment);
injectTapEventPlugin();

const App = () => (
  
    <main>
  
);

render(
  ,
  document.querySelector('#app') // eslint-disable-line
);
</main>
github hotosm / imagery-coordination / app / assets / scripts / views / request-form.js View on Github external
'use strict';
import React, { PropTypes as T } from 'react';
import { connect } from 'react-redux';
import moment from 'moment';
import c from 'classnames';
import _ from 'lodash';
import { hashHistory, Link } from 'react-router';
import DateTimePicker from 'react-widgets/lib/DateTimePicker';
import momentLocalizer from 'react-widgets/lib/localizers/moment';

momentLocalizer(moment);

import { fetchRequest, invalidateRequest, postRequest, patchRequest, resetRequestFrom, deleteRequest } from '../actions';

var RequestForm = React.createClass({
  displayName: 'RequestForm',

  propTypes: {
    _fetchRequest: T.func,
    _invalidateRequest: T.func,
    _postRequest: T.func,
    _patchRequest: T.func,
    _resetRequestFrom: T.func,
    _deleteRequest: T.func,

    params: T.object,
    request: T.object,
github hotosm / imagery-coordination / app / assets / scripts / views / task-form.js View on Github external
'use strict';
import React, { PropTypes as T } from 'react';
import { connect } from 'react-redux';
import { Link, hashHistory } from 'react-router';
import moment from 'moment';
import _ from 'lodash';
import DateTimePicker from 'react-widgets/lib/DateTimePicker';
import momentLocalizer from 'react-widgets/lib/localizers/moment';
import { DOMParser } from 'xmldom';

import toGeoJSON from '../utils/togeojson';
import { geometryToFeature, validateGeoJSONPolygon } from '../utils/features';

momentLocalizer(moment);

import { fetchTask, invalidateTask, postTask, patchTask, resetTaskFrom,
  fetchRequest, invalidateRequest, deleteTask, setMapBaseLayer, fetchRequestTasks } from '../actions';

import EditMap from '../components/edit-map';

var TaskForm = React.createClass({
  displayName: 'TaskForm',

  propTypes: {
    _fetchTask: T.func,
    _invalidateTask: T.func,
    _postTask: T.func,
    _patchTask: T.func,
    _resetTaskFrom: T.func,
    _fetchRequest: T.func,
github Azure / ibex-dashboard / src / components / DataSelector.js View on Github external
import 'react-widgets/dist/css/react-widgets.css';
import '../styles/Header.css';

const TimeSelectionOptions = [
    {label: '', timeType: 'customDatePlaceholder'},
    {label: 'Today', timeType: 'days', subtractFromNow: 0},
    {label: 'Yesterday', timeType: 'days', subtractFromNow: 1},
    {label: 'This Week', timeType: 'weeks', subtractFromNow: 0},
    {label: 'Last Week', timeType: 'weeks', subtractFromNow: 1},
    {label: 'This Month', timeType: 'months', subtractFromNow: 0},
    {label: 'Last Month', timeType: 'months', subtractFromNow: 1},
    {label: 'Select Date', timeType: 'customDate', subtractFromNow: 0},
    {label: 'Select Month', timeType: 'customMonth', subtractFromNow: 0}
];

momentLocalizer(moment);
injectTapEventPlugin();

const FluxMixin = Fluxxor.FluxMixin(React),
      StoreWatchMixin = Fluxxor.StoreWatchMixin("DataStore");

export const DataSelector = React.createClass({
  mixins: [FluxMixin, StoreWatchMixin],
  
  getInitialState(){      
      return{
          timeType: '',
          selectedIndex: 0
      };
  },
  
  getStateFromFlux() {
github guardian / tagmanager / public / components / SponsorshipEdit / ValidityEdit.react.js View on Github external
import React from 'react';
import moment from 'moment';

import DateTimePicker from 'react-widgets/lib/DateTimePicker';
import momentLocalizer from 'react-widgets/lib/localizers/moment';

momentLocalizer(moment);

export default class ValidityEdit extends React.Component {

  constructor(props) {
    super(props);
  }

  setValidFrom(date) {
    this.props.updateSponsorship(Object.assign({}, this.props.sponsorship, {
      validFrom: moment(date).valueOf()
    }));
  }

  setValidTo(date) {
    this.props.updateSponsorship(Object.assign({}, this.props.sponsorship, {
      validTo: moment(date).valueOf()
github guardian / tagmanager / public / components / BatchTag / BatchFilters.react.js View on Github external
import React from 'react';
import moment from 'moment';
import R from 'ramda';

import TagSelect from '../utils/TagSelect';
import SectionSelect from '../utils/SectionSelect.react';

import DateTimePicker from 'react-widgets/lib/DateTimePicker';
import DateTimePickerCSS from 'react-widgets/dist/css/react-widgets.css';
import momentLocalizer from 'react-widgets/lib/localizers/moment';
momentLocalizer(moment);

const CAPI_DATE_FORMAT = 'YYYY-MM-DD';

const PREDEFINED_VALUES = {
  today: {
    'from-date': moment().format(CAPI_DATE_FORMAT),
    'to-date': moment().format(CAPI_DATE_FORMAT)
  },
  thisweek: {
    'from-date': moment().subtract(6, 'days').format(CAPI_DATE_FORMAT),
    'to-date': moment().format(CAPI_DATE_FORMAT)
  },
  thismonth: {
    'from-date': moment().subtract(30, 'days').format(CAPI_DATE_FORMAT),
    'to-date': moment().format(CAPI_DATE_FORMAT)
  }
github redux-form / redux-form / examples / react-widgets / src / ReactWidgetsForm.js View on Github external
import React from 'react'
import { Field, reduxForm } from 'redux-form'
import DropdownList from 'react-widgets/lib/DropdownList'
import SelectList from 'react-widgets/lib/SelectList'
import Multiselect from 'react-widgets/lib/Multiselect'
import DateTimePicker from 'react-widgets/lib/DateTimePicker'
import moment from 'moment'
import momentLocaliser from 'react-widgets/lib/localizers/moment'

import 'react-widgets/dist/css/react-widgets.css'

momentLocaliser(moment)

const colors = [
  { color: 'Red', value: 'ff0000' },
  { color: 'Green', value: '00ff00' },
  { color: 'Blue', value: '0000ff' }
]

const renderDropdownList = ({ input, data, valueField, textField }) =&gt; (
  
)
github EUDAT-B2SHARE / b2share / webui / src / components / editrecord.jsx View on Github external
import React from 'react/lib/ReactWithAddons';
import { Link } from 'react-router'
import { Map, List, fromJS } from 'immutable';
import { compare } from 'fast-json-patch';

import Toggle from 'react-toggle';
import { DateTimePicker, Multiselect, DropdownList, NumberPicker } from 'react-widgets';
import moment from 'moment';
import momentLocalizer from 'react-widgets/lib/localizers/moment';
import numberLocalizer from 'react-widgets/lib/localizers/simple-number';
momentLocalizer(moment);
numberLocalizer();

import { serverCache, notifications, Error, browser } from '../data/server';
import { onAjaxError } from '../data/ajax';
import { keys, pairs, objEquals } from '../data/misc';
import { Wait, Err } from './waiting.jsx';
import { HeightAnimate, ReplaceAnimate } from './animate.jsx';
import { getSchemaOrderedMajorAndMinorFields } from './schema.jsx';
import { EditFiles, PersistentIdentifier } from './editfiles.jsx';
import { Versions } from './versions.jsx';
import { SelectLicense } from './selectlicense.jsx';
import { SelectBig } from './selectbig.jsx';
import { renderSmallCommunity } from './common.jsx';


const invalidFieldMessage = field => `Please provide a correct value for field: ${field}`;
github webdevstar / Dashborad / src / components / DataSelector.js View on Github external
import '../styles/Header.css';

const TimeSelectionOptions = [
    {label: '', timeType: 'customDatePlaceholder'},
    {label: 'Today', timeType: 'days', subtractFromNow: 0},
    {label: 'Yesterday', timeType: 'days', subtractFromNow: 1},
    {label: 'This Week', timeType: 'weeks', subtractFromNow: 1},
    {label: 'Last Week', timeType: 'weeks', subtractFromNow: 2},
    {label: 'This Month', timeType: 'months', subtractFromNow: 0},
    {label: 'Last Month', timeType: 'months', subtractFromNow: 1},
    {label: 'Select Date', timeType: 'customDate', subtractFromNow: 0},
    {label: 'Select Date+Hour', timeType: 'customDateTime', subtractFromNow: 0},
    {label: 'Select Month', timeType: 'customMonth', subtractFromNow: 0}
];

momentLocalizer(moment);
injectTapEventPlugin();

const FluxMixin = Fluxxor.FluxMixin(React),
      StoreWatchMixin = Fluxxor.StoreWatchMixin("DataStore");

export const DataSelector = React.createClass({
  mixins: [FluxMixin, StoreWatchMixin],
  
  getInitialState(){      
      return{
          timeType: '',
          selectedIndex: 0
      };
  },
  
  getStateFromFlux() {