Comments (7)
Good catch - my attempt to make DateField more international-friendly by default by using ISO8601 rather than US date format has clearly backfired! 😄
In the meantime, as a workaround you can of course override formatDate
, just as you would have had to anyway.
As for a fix, toLocaleDateString()
seems like it ought to help, but it defaults to a US date format unless provided with a locale, so unless there's a local that produces ISO8601 style YYYY-MM-DD format, it doesn't quite solve the problem.
There's Intl.DateTimeFormat
, but it isn't supported by all browsers, and pulling in a polyfill just for a default designed to be overridden seems overkill.
The best I've come up with so far is was this slightly hacky workaround:
formatDate={(date) => (new Date(date.toDateString()+" 12:00:00 +0000")).toISOString().substring(0,10)}
Could you check in the browser if that seems to solves the problem for you?
The alternative would be to just use the output of toDateString directly, which, like ISO8601, is unambiguous: "Tue Dec 01 2015", but has the disadvantage that it's in English.
from formsy-material-ui.
Yes, it works perfectly fine. Below is the transcript from the test inside my browser.
> var date = new Date(2015, 11, 1)
<- undefined
> date.toString()
<- "Tue Dec 01 2015 00:00:00 GMT+0100 (Środkowoeuropejski czas stand.)"
> date.toISOString()
<- "2015-11-30T23:00:00.000Z"
> (new Date(date.toDateString()+" 12:00:00 +0000")).toISOString().substring(0,10)
<- "2015-12-01"
from formsy-material-ui.
Thanks for checking.
Could you check against this branch? https://github.com/mbrookes/formsy-material-ui/tree/default-date
Depending on how you import NPMs, you should be able to reference the brach or the specific commit: 43f4955
from formsy-material-ui.
I've tried checking against this commit but things seem to be broken. My build fails with a message:
ERROR in ./src/components/Comment/CommentDialog.js
Module not found: Error: Cannot resolve module 'formsy-material-ui' in /home/osboxes/devel/tmp-web-client/src/components/Comment
...skipped some lines...
resolve file
/home/osboxes/devel/tmp-web-client/node_modules/formsy-material-ui/index.js doesn't exist
I'm using ES6 syntax in my code.
My understanding is that somehow package.json file was also edited and "main": "lib/index.js"
was replaced with "main": "index.js"
and there is no such file in main dir.
I've tried to find a commit that did this thing but wasn't successful. It seems that version 0.3.2 was released from version than had not been pushed into main repo. I say that because I can't see "gitHead": "e43fd8fec546c68766495e154bf3d81393f38dd7"
(package.json:53 from [email protected]) in repo which is strange. No such commit.
from formsy-material-ui.
You're right - it looks like I published from the separate-components
branch instead of merging and publishing from master. Rather than try to reconcile now, I've updated the default-date
branch with what should be a working package.json (and a transpiled version of FormsyDate).
If it looks okay for you, then I'll try to clean up my branch / commit foobar and merge this with master and publish.
from formsy-material-ui.
Yes, default-date
works as expected now. Thanks for prompt support.
from formsy-material-ui.
0.3.3 published to NPM. Thanks for the report.
from formsy-material-ui.
Related Issues (20)
- Is there a component for file upload? HOT 1
- FormsySelect onChange getting bypassed HOT 3
- Support the incoming Material UI v1.0 HOT 10
- Text field underline color broken after 0.6.1 HOT 10
- FormsyText with type="number" bad behavior HOT 3
- FormsyAutoComplete does not use provided default value HOT 2
- FormsySelect required is not showing any error when submit the form HOT 9
- Remove FormsyAutoComplete component? HOT 1
- Warning: getDefaultProps
- FormsySelect does not change underline color when selected HOT 1
- Not working with React 16.1.1 HOT 1
- Support new Formsy
- Incorrect directory HOT 6
- Support formsy-react v1.1.2 HOT 4
- FormsyDate and FormsyTime don't handle value argument properly
- FormsyText cannot accept value 0
- Not compatible HOT 1
- not compatible with React 16.3.1 HOT 1
- Accept a list of validation errors?
- Is This Project Maintained? HOT 15
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from formsy-material-ui.