Git Product home page Git Product logo

react-admin-date-inputs's Introduction

react-admin-date-inputs

<DateInput>, <TimeInput> and <DateTimeInput> components for React-Admin.

date-time-picker.gif

Installation

npm install 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.

// on index.html
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
import React from 'react';
import {
    Edit,
    TextInput,
    TabbedForm,
    FormTab,
} from 'react-admin'
import { DateInput, TimeInput, DateTimeInput } from 'react-admin-date-inputs';

export const NewsEdit = (props) => (
  <Edit title={<NewsTitle />} {...props}>
    <TabbedForm>
      <FormTab>
        <LongTextInput source="title" validate={required} />
        <DateInput source="startDate" label="Start date" options={{ format: 'DD/MM/YYYY' }} />
        <TimeInput source="startTime" label="Start time" options={{ format: 'HH:mm:ss' }} />
        <DateTimeInput source="endDate" label="End time" options={{ format: 'DD/MM/YYYY, HH:mm:ss', ampm: false, clearable: true }} />
      </FormTab>
    </TabbedForm>
  </Edit>
);

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:

import DateFnsUtils from '@date-io/date-fns';
import MomentUtils from 'material-ui-pickers/utils/moment-utils';
import frLocale from "date-fns/locale/fr";

...
<DateInput source="date" label="Date using moment" providerOptions={{ utils: MomentUtils }} />
<DateInput source="date" label="Date in French!" providerOptions={{ utils: DateFnsUtils, locale: frLocale }} />

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

License

This library is licensed under the MIT Licence.

react-admin-date-inputs's People

Contributors

afilp avatar cherniavskii avatar ihrigb avatar lihop avatar stephme avatar vascofg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

react-admin-date-inputs's Issues

TimeInput component's value is the full date.

code is :
<TimeInput {...prop} options={{format: 'HH:mm:ss'}}/>

I use 'format' to format display. but the value is like this: 'Thu Mar 21 2019 00:58:01 GMT+0800'

I want value is like this: '00:58:01'.

thanks.

Can't resolve 'material-ui-pickers/utils/MuiPickersUtilsProvider'

Hello, I am having this problem with our project and we can't fix it.
This is where error is happening:
Module not found: Can't resolve 'material-ui-pickers/utils/MuiPickersUtilsProvider' in '...\node_modules\react-admin-date-inputs\lib'
Is there any fix for this?

DateInput stores wrong date if timezone is +2

When storing a date with dateinput, while local time is ahead of UTC, the time storing is a bit "funny". As it is converted to datetime and to utc, the actual date stored is the day before the selected one, since the time on the date is 0:00 and decreasing it by 2 hours will take it to the previous day.
This causes some serious problems if the date is converted to a date in backend, simply throwing away the time part.
I did find some ways to get around this from react-admin issues, but shouldn't this be something that is resolved in the component itself, maybe as an optional "switch"?

EDIT: Actually, why dateinput doesn't just send a date (like the react-admin basic dateinput), why is the "time" included?
EDIT2: By "switch" I mean for example having an option to choose what timezone the date(or time in datetime) is entered in. If this kind of option exists, I was unable to find it.

getStartOfMonth is not a function error

Hi!

Trying to use this with react-admin 2.7.1 and when using a I get the following error when clicking on the field:

TypeError: _this.props.utils.getStartOfMonth is not a function

The versions for my other packages are:
"@date-io/date-fns": "^1.1.0",
"date-fns": "^2.0.0-alpha.27",

If I can provide any other info, please let me know!

Months' days are displayed with year's days' numbers

Hello!

I wanted to try your package, but when I use it with the latest react-admin, I see the year's day numbers instead of the month's day numbers.

Screenshot

Edit:

Upon investigation, it seems this is a problem from using DateFnsUtils. Using Moment works properly

update date-fns to the latest version

I noticed you are using the version "date-fns": "2.0.0-alpha.16", but the latest is 2.0.0-alpha.27. At least a bunch of locales are missing on the older version.

Utils as property

@@ -23,9 +23,10 @@
         isRequired,
         className,
         meta,
+        utils,
       } = this.props;
 
       const { touched, error } = meta;
 
       return (
         <div className="picker">
@@ -26,10 +27,10 @@
       } = this.props;
 
       const { touched, error } = meta;
 
       return (
         <div className="picker">
-          <MuiPickersUtilsProvider utils={DateFnsUtils} locale={locale}>
+          <MuiPickersUtilsProvider utils={utils} locale={locale}>
             <PickerComponent
               {...options}
               label={<FieldTitle
@@ -62,6 +63,7 @@
     labelTime: PropTypes.string,
     className: PropTypes.string,
     locale: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
+    utils: PropTypes.func,
   };
 
   _makePicker.defaultProps = {
@@ -75,6 +77,7 @@
     labelTime: '',
     className: '',
     locale: undefined,
+    utils: DateFnsUtils,
   };
   return _makePicker;
 };

Add a screenshot in the README

I looked for a conformation that this repo implemented the recommended material-ui design for date pickers... And I didn't find it.

A simple screenshot embedded in the README would do the trick.

Is there any plan to release?

Hi, thank you for this component and your dedication for this repository.
The latest code looks working well, but when I added this to my repository, faced some errors.
I'm struggled with that error like 'material-ui-picker/utils/MuiPickersUtilsProvider not found ' and found that the latest code was not released.
I checked http://registry.npmjs.org/react-admin-date-inputs . The last release is 2019-10-22 which tag is 1.1.4. Since then, there were lots of commit and I need them.
I hope you to release this repository very soon.
And I suggest a release tag for each release for finding code to view and debug.

If not possible, is there any way to use this component in my repostiory?

Module not found: Can't resolve 'date-fns/addDays'

Just installed the library, and when I require the TimeInput, I get the following compile error:

Failed to compile
./node_modules/material-ui-pickers/utils/date-fns-utils.js
Module not found: Can't resolve 'date-fns/addDays' in '/var/www/football-rental/node_modules/material-ui-pickers/utils'
This error occurred during the build time and cannot be dismissed.

I even added date-fns to my package.json, but no luck.

I saw this error in a closed unrelated issue here: #15 (comment)

Can't resolve 'material-ui-pickers/utils/MuiPickersUtilsProvider'

Hello,

I installed react-admin-dateinputs and I'm trying to use TimeInput but I have this error:
Module not found: Can't resolve 'material-ui-pickers/utils/MuiPickersUtilsProvider' in '/Users/pierre/Documents/schoolx/frontend/node_modules/react-admin-date-inputs/lib'

Here is my package.json:

{
"name": "schoolx-frontend",
"version": "0.1.0",
"private": true,
"dependencies": {
"import": "^0.0.6",
"jsonwebtoken": "^8.3.0",
"moment": "^2.22.2",
"ra-data-json-server": "^2.2.0",
"ra-language-english": "^2.2.0",
"ra-language-french": "^2.2.0",
"react": "^16.4.2",
"react-admin": "^2.4.0",
"react-admin-date-inputs": "^1.1.0",
"react-big-calendar": "^0.20.1",
"react-dom": "^16.4.2",
"react-router-dom": "^4.3.1",
"react-scripts": "1.1.4",
"recompose": "^0.28.2"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}

I tried to install the module material-ui-pickers but it didn't change anything.

Do you have an idea of how I can make it work ?
Thanks :)

Upgrade to latest versions of React Admin and Material-UI

Hi, React Admin maintainers here. Thanks for making this lib!

We had an issue about your library on react-admin: marmelab/react-admin#2795
react-admin-date-inputs seems to no longer be working because of out-to-date dependencies.

I closed the issue because it is not directly related to react-admin.

I see that you have a opened PR about this: #17
Let me know if you need something more to support the latest versions of RA!

You are calling withTheme(Component) with an undefined component. You may have forgotten to import it.

If I try and use with react-admin

import { DateTimeInput } from 'react-admin-date-inputs';

with

<DateTimeInput label="Start" options={{ format: 'DD/MM/YYYY, HH:mm:ss', ampm: false, clearable: true }} />

Error: You are calling withTheme(Component) with an undefined component.
You may have forgotten to import it.

I have the following dependancies

"dependencies": {
    "@material-ui/core": "^4.5.1",
    "@material-ui/icons": "^4.5.1",
    "axios": "^0.18.0",
    "date-fns": "^2.5.1",
    "filepond": "^4.7.2",
    "jwt-decode": "^2.2.0",
    "prop-types": "^15.7.2",
    "ra-data-json-server": "^2.9.8",
    "ra-data-simple-rest": "^2.6.2",
    "react": "^16.10.2",
    "react-admin": "^2.9.8",
    "react-admin-date-inputs": "^1.1.2",
    "react-beautiful-dnd": "^11.0.3",
    "react-dom": "^16.10.2",
    "react-draggable-list": "^4.0.2",
    "react-filepond": "^7.0.1",
    "react-player": "^1.10.0",
    "react-scripts": "^3.2.0",
    "redux": "^4.0.1",
    "video-react": "^0.13.6"
  },

Internal value for DatePicker has inconsistent time component

Not sure if this is a problem in your component or upstream library but there is inconsistency in DatePicker value behavior.

When setting a value from none to the "Today"/highlighted date, the value becomes a Date with current time components (hours, minutes, seconds). When setting a value to an explicit date (past/future) the value becomes the Date without time component (hours/minutes/seconds = 0/0/0).

My opinion is that time components should be 0 when only using DatePicker (aka midnight of the date selected).

label is not taken from resource

Hi,

first of all thanks for your effort!

When I started using your component instead of the original react-admin's DateInput, all labels have disappeared. Wouldn't it be nice if the basic functions behave the same as in the original component and display the labels based on the ressource field (including the translation)?

I'm using "react-admin-date-inputs": "^1.0.17".

This is my first issue report - if I did something wrong, let me know. I'm willing to learn.

Cheers,
Mitch

DateInput gets the wrong Day with 3 digits

I put a DateInput in the Filters of a List as below:

<DateInput label="Date" source="date" filterDefaultValues={moment().format('YYYY-MM-DD')} options={{ format: 'YYYY-MM-DD' }} alwaysOn/>

But the DateInput get a wrong Day value, like '2019-09-245', while I pick the date: 2019-09-02.

I guess it's about timezone? But nowhere to adjust the timezone.

mui-pickers-v3.

I've created a branch in my fork compatible with react-admin v3.

  • material-ui-pickers change to @material-ui/pickers v3.
  • Dependencies upgraded.
  • Uses a functional component.
  • Uses react-admin useInput instead of the deprecated addField.
  • Added KeyboardDateInput, KeyboardDateTimeInput and KeyboardTimeInput.
  • Ported props from react-admin's DateInput component for consistency with the rest of react-admin input components.

You can check it out here:
https://github.com/WiXSL/react-admin-date-inputs/tree/mui-pickers-v3

Validation error is not displayed

Validation error is not displayed when DateInput fails validation.

      <DateInput
        label="Happened on"
        source="happened_on"
        validate={[required()]}
        options={{
          clearable: true,
          format: 'DD/MM/YYYY',
        }}
      />

The form fails to validate however the Input styling does not change to indicate an error.

Locale gives problem in edit form.


    in DateTextField
    in WithUtils(DateTextField) (created by WithStyles(WithUtils(DateTextField)))
    in WithStyles(WithUtils(DateTextField)) (created by ModalWrapper)
    in ModalWrapper (created by RenderPropsComponent)
    in RenderPropsComponent (created by withHandlers(RenderPropsComponent))
    in withHandlers(RenderPropsComponent) (created by lifecycle(withHandlers(RenderPropsComponent)))
    in lifecycle(withHandlers(RenderPropsComponent)) (created by withState(lifecycle(withHandlers(RenderPropsComponent))))
    in withState(lifecycle(withHandlers(RenderPropsComponent))) (created by BasePicker)
    in BasePicker
    in WithUtils(BasePicker) (created by DatePickerWrapper)
    in DatePickerWrapper (created by ForwardRef)
    in MuiPickersUtilsProvider (created by _makePicker)
    in div (created by _makePicker)
    in _makePicker (created by ConnectedField)
    in ConnectedField (created by Connect(ConnectedField))
    in Connect(ConnectedField) (created by Field)
    in Field (created by FormFieldView)
    in FormFieldView (created by DefaultValue)
    in DefaultValue (created by Connect(DefaultValue))
    in Connect(DefaultValue) (created by WithFormField)
    in WithFormField (at HealthCareEdit.js:56)
    in div (created by FormInput)
    in FormInput (created by WithStyles(FormInput))
    in WithStyles(FormInput) (created by FormTab)
    in span (created by FormTab)
    in FormTab (created by translate(FormTab))
    in translate(FormTab) (at HealthCareEdit.js:51)
    in Route (created by TabbedForm)
    in div (created by TabbedForm)
    in form (created by TabbedForm)
    in TabbedForm (created by WithStyles(TabbedForm))
    in WithStyles(TabbedForm) (created by Form(WithStyles(TabbedForm)))
    in Form(WithStyles(TabbedForm)) (created by Connect(Form(WithStyles(TabbedForm))))
    in Connect(Form(WithStyles(TabbedForm))) (created by ReduxForm)
    in ReduxForm (created by translate(ReduxForm))
    in translate(ReduxForm) (created by Connect(translate(ReduxForm)))
    in Connect(translate(ReduxForm)) (created by Route)
    in Route (created by withRouter(Connect(translate(ReduxForm))))
    in withRouter(Connect(translate(ReduxForm))) (at HealthCareEdit.js:50)
    in div (created by Paper)
    in Paper (created by WithStyles(Paper))
    in WithStyles(Paper) (created by Card)
    in Card (created by WithStyles(Card))
    in WithStyles(Card) (created by EditView)
    in div (created by EditView)
    in EditView (created by EditController)
    in EditController (created by translate(EditController))
    in translate(EditController) (created by Connect(translate(EditController)))
    in Connect(translate(EditController)) (created by Edit)
    in Edit (at HealthCareEdit.js:49)
    in HealthCareEdit (at App.js:75)
    in Unknown (created by WithPermissions)
    in WithPermissions (created by Connect(WithPermissions))
    in Connect(WithPermissions) (created by getContext(Connect(WithPermissions)))
    in getContext(Connect(WithPermissions)) (created by Route)
    in Route (created by Resource)
    in Switch (created by Resource)
    in Resource (created by Connect(Resource))
    in Connect(Resource) (created by AdminBuilder)
    in Route (created by RoutesWithLayout)
    in Switch (created by RoutesWithLayout)
    in RoutesWithLayout (created by Route)
    in div (created by Layout)
    in main (created by Layout)
    in div (created by Layout)
    in div (created by Layout)
    in Layout (created by WithStyles(Layout))
    in WithStyles(Layout) (created by Route)
    in Route (created by withRouter(WithStyles(Layout)))
    in withRouter(WithStyles(Layout)) (created by Connect(withRouter(WithStyles(Layout))))
    in Connect(withRouter(WithStyles(Layout))) (created by LayoutWithTheme)
    in MuiThemeProvider (created by LayoutWithTheme)
    in LayoutWithTheme (created by Route)
    in Route (created by CoreAdminRouter)
    in Switch (created by CoreAdminRouter)
    in div (created by CoreAdminRouter)
    in CoreAdminRouter (created by Connect(CoreAdminRouter))
    in Connect(CoreAdminRouter) (created by getContext(Connect(CoreAdminRouter)))
    in getContext(Connect(CoreAdminRouter)) (created by Route)
    in Route (created by CoreAdmin)
    in Switch (created by CoreAdmin)
    in Router (created by ConnectedRouter)
    in ConnectedRouter (created by CoreAdmin)
    in TranslationProvider (created by withContext(TranslationProvider))
    in withContext(TranslationProvider) (created by Connect(withContext(TranslationProvider)))
    in Connect(withContext(TranslationProvider)) (created by CoreAdmin)
    in Provider (created by CoreAdmin)
    in CoreAdmin (created by withContext(CoreAdmin))
    in withContext(CoreAdmin) (created by AdminBuilder)
    in AdminBuilder (created by _class)
    in _class (at App.js:147)
    in Unknown (at index.js:7)```

DateInput with MomentUtils has problematic behavior when used in Filters

Hi! When DateInput is used in a Filter it sends a complicated Moment object in the backend api

    <Filter {...props}>
        <TextInput label="Search" source="q" alwaysOn />
        <TextInput source="alias" />
        <DateInput source="startDate" options={{ format: 'DD/MM/YYYY' }} providerOptions={{ utils: MomentUtils }} />
    </Filter>
);

export const TaskList = (props) => (
    <List {...props} filters={<TaskFilter />}>
        <Datagrid>
            <TextField source="id" />
            <TextField source="alias" />
            <DateField source="startDate" locales="el-GR" />
            <DateField source="endDate" />
            <EditButton />
        </Datagrid>
    </List>
);

browser url:

http://localhost:3000/#/tasks?filter=%7B%22startDate%22%3A%7B%22_isAMomentObject%22%3Atrue%2C%22_isUTC%22%3Afalse%2C%22_pf%22%3A%7B%22empty%22%3Afalse%2C%22overflow%22%3A-2%2C%22charsLeftOver%22%3A0%2C%22nullInput%22%3Afalse%2C%22invalidFormat%22%3Afalse%2C%22userInvalidated%22%3Afalse%2C%22iso%22%3Afalse%2C%22rfc2822%22%3Afalse%2C%22weekdayMismatch%22%3Afalse%7D%2C%22_locale%22%3A%7B%22_calendar%22%3A%7B%22sameDay%22%3A%22%5BToday%20at%5D%20LT%22%2C%22nextDay%22%3A%22%5BTomorrow%20at%5D%20LT%22%2C%22nextWeek%22%3A%22dddd%20%5Bat%5D%20LT%22%2C%22lastDay%22%3A%22%5BYesterday%20at%5D%20LT%22%2C%22lastWeek%22%3A%22%5BLast%5D%20dddd%20%5Bat%5D%20LT%22%2C%22sameElse%22%3A%22L%22%7D%2C%22_longDateFormat%22%3A%7B%22LTS%22%3A%22h%3Amm%3Ass%20A%22%2C%22LT%22%3A%22h%3Amm%20A%22%2C%22L%22%3A%22MM%2FDD%2FYYYY%22%2C%22LL%22%3A%22MMMM%20D%2C%20YYYY%22%2C%22LLL%22%3A%22MMMM%20D%2C%20YYYY%20h%3Amm%20A%22%2C%22LLLL%22%3A%22dddd%2C%20MMMM%20D%2C%20YYYY%20h%3Amm%20A%22%7D%2C%22_invalidDate%22%3A%22Invalid%20date%22%2C%22_relativeTime%22%3A%7B%22future%22%3A%22in%20%25s%22%2C%22past%22%3A%22%25s%20ago%22%2C%22s%22%3A%22a%20few%20seconds%22%2C%22ss%22%3A%22%25d%20seconds%22%2C%22m%22%3A%22a%20minute%22%2C%22mm%22%3A%22%25d%20minutes%22%2C%22h%22%3A%22an%20hour%22%2C%22hh%22%3A%22%25d%20hours%22%2C%22d%22%3A%22a%20day%22%2C%22dd%22%3A%22%25d%20days%22%2C%22M%22%3A%22a%20month%22%2C%22MM%22%3A%22%25d%20months%22%2C%22y%22%3A%22a%20year%22%2C%22yy%22%3A%22%25d%20years%22%7D%2C%22_months%22%3A%5B%22January%22%2C%22February%22%2C%22March%22%2C%22April%22%2C%22May%22%2C%22June%22%2C%22July%22%2C%22August%22%2C%22September%22%2C%22October%22%2C%22November%22%2C%22December%22%5D%2C%22_monthsShort%22%3A%5B%22Jan%22%2C%22Feb%22%2C%22Mar%22%2C%22Apr%22%2C%22May%22%2C%22Jun%22%2C%22Jul%22%2C%22Aug%22%2C%22Sep%22%2C%22Oct%22%2C%22Nov%22%2C%22Dec%22%5D%2C%22_week%22%3A%7B%22dow%22%3A0%2C%22doy%22%3A6%7D%2C%22_weekdays%22%3A%5B%22Sunday%22%2C%22Monday%22%2C%22Tuesday%22%2C%22Wednesday%22%2C%22Thursday%22%2C%22Friday%22%2C%22Saturday%22%5D%2C%22_weekdaysMin%22%3A%5B%22Su%22%2C%22Mo%22%2C%22Tu%22%2C%22We%22%2C%22Th%22%2C%22Fr%22%2C%22Sa%22%5D%2C%22_weekdaysShort%22%3A%5B%22Sun%22%2C%22Mon%22%2C%22Tue%22%2C%22Wed%22%2C%22Thu%22%2C%22Fri%22%2C%22Sat%22%5D%2C%22_abbr%22%3A%22en%22%2C%22_config%22%3A%7B%22calendar%22%3A%7B%22sameDay%22%3A%22%5BToday%20at%5D%20LT%22%2C%22nextDay%22%3A%22%5BTomorrow%20at%5D%20LT%22%2C%22nextWeek%22%3A%22dddd%20%5Bat%5D%20LT%22%2C%22lastDay%22%3A%22%5BYesterday%20at%5D%20LT%22%2C%22lastWeek%22%3A%22%5BLast%5D%20dddd%20%5Bat%5D%20LT%22%2C%22sameElse%22%3A%22L%22%7D%2C%22longDateFormat%22%3A%7B%22LTS%22%3A%22h%3Amm%3Ass%20A%22%2C%22LT%22%3A%22h%3Amm%20A%22%2C%22L%22%3A%22MM%2FDD%2FYYYY%22%2C%22LL%22%3A%22MMMM%20D%2C%20YYYY%22%2C%22LLL%22%3A%22MMMM%20D%2C%20YYYY%20h%3Amm%20A%22%2C%22LLLL%22%3A%22dddd%2C%20MMMM%20D%2C%20YYYY%20h%3Amm%20A%22%7D%2C%22invalidDate%22%3A%22Invalid%20date%22%2C%22relativeTime%22%3A%7B%22future%22%3A%22in%20%25s%22%2C%22past%22%3A%22%25s%20ago%22%2C%22s%22%3A%22a%20few%20seconds%22%2C%22ss%22%3A%22%25d%20seconds%22%2C%22m%22%3A%22a%20minute%22%2C%22mm%22%3A%22%25d%20minutes%22%2C%22h%22%3A%22an%20hour%22%2C%22hh%22%3A%22%25d%20hours%22%2C%22d%22%3A%22a%20day%22%2C%22dd%22%3A%22%25d%20days%22%2C%22M%22%3A%22a%20month%22%2C%22MM%22%3A%22%25d%20months%22%2C%22y%22%3A%22a%20year%22%2C%22yy%22%3A%22%25d%20years%22%7D%2C%22months%22%3A%5B%22January%22%2C%22February%22%2C%22March%22%2C%22April%22%2C%22May%22%2C%22June%22%2C%22July%22%2C%22August%22%2C%22September%22%2C%22October%22%2C%22November%22%2C%22December%22%5D%2C%22monthsShort%22%3A%5B%22Jan%22%2C%22Feb%22%2C%22Mar%22%2C%22Apr%22%2C%22May%22%2C%22Jun%22%2C%22Jul%22%2C%22Aug%22%2C%22Sep%22%2C%22Oct%22%2C%22Nov%22%2C%22Dec%22%5D%2C%22week%22%3A%7B%22dow%22%3A0%2C%22doy%22%3A6%7D%2C%22weekdays%22%3A%5B%22Sunday%22%2C%22Monday%22%2C%22Tuesday%22%2C%22Wednesday%22%2C%22Thursday%22%2C%22Friday%22%2C%22Saturday%22%5D%2C%22weekdaysMin%22%3A%5B%22Su%22%2C%22Mo%22%2C%22Tu%22%2C%22We%22%2C%22Th%22%2C%22Fr%22%2C%22Sa%22%5D%2C%22weekdaysShort%22%3A%5B%22Sun%22%2C%22Mon%22%2C%22Tue%22%2C%22Wed%22%2C%22Thu%22%2C%22Fri%22%2C%22Sat%22%5D%2C%22abbr%22%3A%22en%22%7D%7D%2C%22_d%22%3A%222018-09-12T21%3A00%3A00.000Z%22%2C%22_isValid%22%3Atrue%7D%7D&order=DESC&page=1&perPage=10&sort=id

url decoded:

http://localhost:3000/#/tasks?filter={"startDate":{"_isAMomentObject":true,"_isUTC":false,"_pf":{"empty":false,"overflow":-2,"charsLeftOver":0,"nullInput":false,"invalidFormat":false,"userInvalidated":false,"iso":false,"rfc2822":false,"weekdayMismatch":false},"_locale":{"_calendar":{"sameDay":"[Today at] LT","nextDay":"[Tomorrow at] LT","nextWeek":"dddd [at] LT","lastDay":"[Yesterday at] LT","lastWeek":"[Last] dddd [at] LT","sameElse":"L"},"_longDateFormat":{"LTS":"h:mm:ss A","LT":"h:mm A","L":"MM/DD/YYYY","LL":"MMMM D, YYYY","LLL":"MMMM D, YYYY h:mm A","LLLL":"dddd, MMMM D, YYYY h:mm A"},"_invalidDate":"Invalid date","_relativeTime":{"future":"in %s","past":"%s ago","s":"a few seconds","ss":"%d seconds","m":"a minute","mm":"%d minutes","h":"an hour","hh":"%d hours","d":"a day","dd":"%d days","M":"a month","MM":"%d months","y":"a year","yy":"%d years"},"_months":["January","February","March","April","May","June","July","August","September","October","November","December"],"_monthsShort":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],"_week":{"dow":0,"doy":6},"_weekdays":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"_weekdaysMin":["Su","Mo","Tu","We","Th","Fr","Sa"],"_weekdaysShort":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"_abbr":"en","_config":{"calendar":{"sameDay":"[Today at] LT","nextDay":"[Tomorrow at] LT","nextWeek":"dddd [at] LT","lastDay":"[Yesterday at] LT","lastWeek":"[Last] dddd [at] LT","sameElse":"L"},"longDateFormat":{"LTS":"h:mm:ss A","LT":"h:mm A","L":"MM/DD/YYYY","LL":"MMMM D, YYYY","LLL":"MMMM D, YYYY h:mm A","LLLL":"dddd, MMMM D, YYYY h:mm A"},"invalidDate":"Invalid date","relativeTime":{"future":"in %s","past":"%s ago","s":"a few seconds","ss":"%d seconds","m":"a minute","mm":"%d minutes","h":"an hour","hh":"%d hours","d":"a day","dd":"%d days","M":"a month","MM":"%d months","y":"a year","yy":"%d years"},"months":["January","February","March","April","May","June","July","August","September","October","November","December"],"monthsShort":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],"week":{"dow":0,"doy":6},"weekdays":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"weekdaysMin":["Su","Mo","Tu","We","Th","Fr","Sa"],"weekdaysShort":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"abbr":"en"}},"_d":"2018-09-12T21:00:00.000Z","_isValid":true}}&order=DESC&page=1&perPage=10&sort=id

it should have been just http://localhost:3000/#/tasks?filter={"startDate":"string in original parsed date format"}

Are `parse` and `format` supported?

I tried to use them but I get an error due to an "undefined" value in parse, as a result of the onBlur function being called without the date parameter:

image

Am I missing something?

Thanks.

error display in console

Hello,
thanks for your libraries. It works correctly but I have one error which display in console.

capture d ecran 2018-10-11 a 10 47 05

Despite the error, it works.

Localization

Locale property is missing
<MuiPickersUtilsProvider utils={DateFnsUtils} locale={locale}>

mui-pickers-v4

I've created a branch in my fork compatible with Material-UI Pickers v4

  • @material-ui/pickers ^3.2.8 to ^4.0.0-alpha.10
  • Dependencies upgraded
  • Replace MuiPickersUtilsProvider by LocalizationProvider
  • Import DateRangeDelimiter, DateRangePicker components
  • Added DateRangeInput

I haven't tested completely so it may have some issues, but it's a start.
You can check it out here: https://github.com/emulienfou/react-admin-date-inputs/tree/mui-pickers-v4

Buttons not translated

Hey guys, my buttons (ok, cancel, clear) are not translated properly and I cannot find any way to overwrite the text of the buttons.
Following my code to render DateInput in german. Besides of the buttons everything else is translated properly.

`import deLocale from "date-fns/locale/de";
import DateFnsUtils from '@date-io/date-fns';
import {DateInput} from 'react-admin-date-inputs';

<DateInput
alwaysOn
source="startDate"
label="Start"
parse={dateParser}
providerOptions={{ utils: DateFnsUtils, locale: deLocale }}
options={{ format: 'dd.MM.YYYY', clearable: true }}
/>`

Thank you in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.