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/Calendar] Feature Request: Default "firstDayOfWeek" prop for Calendar component #5037

Closed
overthemike opened this issue Aug 20, 2016 · 6 comments
Labels
component: date picker This is the name of the generic UI component, not the React module!

Comments

@overthemike
Copy link

Description

When reading #3104, as I was looking for something similar, I noticed that the Calendar component, when used on its own and without passing properties, doesn't separate the rows of each week. While I necessarily don't think this is a bug, as the Calendar is used in a way that's unintended, a simple fix would be to provide a default "firstDayOfWeek" property so it's not needed when rendering out an "always there" calendar.

Images & references

The following screenshot below comes up from this code:

import React from 'react';
import Calendar from 'material-ui/DatePicker/Calendar'

export default () => <Calendar />

screen shot 2016-08-20 at 2 56 26 pm

The fix, while simple enough, isn't documented anywhere that I could find.

import React from 'react';
import Calendar from 'material-ui/DatePicker/Calendar'

export default () => <Calendar firstDayOfWeek={1} />

screen shot 2016-08-20 at 3 07 29 pm

overthemike pushed a commit to overthemike/material-ui that referenced this issue Aug 20, 2016
@oliviertassinari oliviertassinari added the component: date picker This is the name of the generic UI component, not the React module! label Oct 19, 2016
@iheidt
Copy link

iheidt commented May 24, 2017

The default for firstDayOfWeek should be 0 = Sunday.

Look at Google examples:
https://material.io/guidelines/components/pickers.html#pickers-date-pickers

@overthemike
Copy link
Author

This ticket was closed as seen in the discussion at #5038. I put default as 1 at the time because that's what it was in the code here: https://github.com/callemall/material-ui/blob/master/src/DatePicker/DatePicker.js#L157

@mbrookes
Copy link
Member

@iheidt We are following ISO-8601 for the default, so it is correct. Google examples just show a US localized example.

@oliviertassinari
Copy link
Member

Closing for #4787

@hadiMh
Copy link

hadiMh commented Jul 8, 2019

How can I use the Calendar component itself?
I just wanna use the Calendar itself to show it on the page. Please tell me how to use it. I have got errors. I explain details below:

I have used "@material-ui/pickers": "^3.1.2" and I have imported these two like this:
import { DatePicker, MuiPickersUtilsProvider } from '@material-ui/pickers';
but I get error.

How can I use this component. I have tried like this:
return ( <MuiPickersUtilsProvider {...extraProviderProps}> <Calendar /> </MuiPickersUtilsProvider> );
Please explain how to use.

Btw the error I get is this:
Can not find utils in context. You either a) forgot to wrap your component tree in MuiPickersUtilsProvider; or b) mixed named and direct file imports. Recommendation: use name imports from the module index.

Thanks is advance

@oliviertassinari
Copy link
Member

@hadiMh Could you move the concern to https://github.com/mui-org/material-ui-pickers?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: date picker This is the name of the generic UI component, not the React module!
Projects
None yet
Development

No branches or pull requests

5 participants