Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DatePicker format #1461

Closed
valinol opened this issue Aug 20, 2015 · 7 comments
Closed

DatePicker format #1461

valinol opened this issue Aug 20, 2015 · 7 comments
Labels
docs Improvements or additions to the documentation v0.x

Comments

@valinol
Copy link

valinol commented Aug 20, 2015

This is more a question than a issue, someone can show me a example of how can i change de dateformat to YYYY/MM/DD

I think that the demo page need this example to.

@LyricL-Gitster
Copy link

You've probably solved this by now, but in case someone else has the same issue, there is an optional 'formatDate' prop on DatePicker which the date will be passed through on its way to the TextField.

@valinol
Copy link
Author

valinol commented Sep 1, 2015

I still have not solved, the props are there but I would like to see a working example, it say you have to pass a function but not in what format.

@LyricL-Gitster
Copy link

You need to pass a function that takes a Date and returns a String:

formatDate(date){
  return date.getFullYear() + "/" + (date.getMonth() + 1) + "/" + date.getDate();
}

render(){
  return <DatePicker formatDate={this.formatDate} />;
}

EDIT: fixed formatting

@conor909
Copy link

conor909 commented Dec 2, 2015

So what does formatDate do?

@oliviertassinari oliviertassinari added the docs Improvements or additions to the documentation label Feb 27, 2016
@oliviertassinari
Copy link
Member

The documentation was greatly improved since this issue was opened. #3417 is also adding an example on how to do it.

@ausrasul
Copy link

ausrasul commented Nov 4, 2016

@varma89
Copy link

varma89 commented Feb 11, 2019

Hi every one, I am using material ui date-picker from material ui core. It shows january12th(for example) like this I want this format to dd/mm/yy. format. I set initially new Date(); .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to the documentation v0.x
Projects
None yet
Development

No branches or pull requests

6 participants