react-admin-date-inputs
npm install @shinabr2/react-admin-date-inputs
npm install @shinabr2/react-admin-date-inputs --save
`
Usage
You have to include an icon font to display the icons on the picker. This is mentioned on the bottom of the material-ui-pickers installation page.
`html
// on index.html
rel="stylesheet"
href="https://fonts.googleapis.com/icon?family=Material+Icons"
/>
`
`jsx
import React from 'react';
import { Edit, TextInput, TabbedForm, FormTab } from 'react-admin';
import {
DateInput,
TimeInput,
DateTimeInput,
KeyBoardDateInput
} from 'react-admin-date-inputs';
export const NewsEdit = (props) => (
} {...props}>
source="startDate"
label="Start date"
options={{ format: 'DD/MM/YYYY' }}
/>
source="startTime"
label="Start time"
options={{ format: 'HH:mm:ss' }}
/>
source="endDate"
label="End time"
options={{
format: 'DD/MM/YYYY, HH:mm:ss',
ampm: false,
clearable: true
}}
/>
);
`
Options prop
The options prop is passed down to the pickers. Documentation for these options can be found in the material-ui-pickers documentation for the component you're trying to use.
providerOptions prop
If you want to use a date parser utils library other than date-fns or you want a locale other than english, you can pass the providerOptions prop:
`jsx
import DateFnsUtils from '@date-io/date-fns';
import MomentUtils from 'material-ui-pickers/utils/moment-utils';
import frLocale from "date-fns/locale/fr";
...
`
NOTE: When specifying a locale you must also specify the utils, even if it's the default DateFnsUtils.
Development
You can build sources:
`
npm run build
``