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

TimeRange - Allow specifying arrayOfWeekdays #1764

Closed
anton-johansson opened this issue Sep 6, 2021 · 7 comments
Closed

TimeRange - Allow specifying arrayOfWeekdays #1764

anton-johansson opened this issue Sep 6, 2021 · 7 comments

Comments

@anton-johansson
Copy link

anton-johansson commented Sep 6, 2021

Is your feature request related to a problem? Please describe.
I want to Monday to be the first row instead of Sunday.

Describe the solution you'd like
Should be easy to allow passing in arrayOfWeekdays as a property to TimeRange that is passed down to computeWeekdays:

const weekdayLegends = computeWeekdays({

Or maybe more clean: A property to indicate which is the first day of the week.

Describe alternatives you've considered
None.

@plouc
Copy link
Owner

plouc commented Sep 6, 2021

@anton-johansson, if you think the solution is easy to implement, please do not hesitate to submit a PR ;)

@plouc plouc added 📆 calendar @nivo/calendar package 🆕 feature request labels Sep 6, 2021
@aried3r
Copy link

aried3r commented Sep 6, 2021

@plouc, what do you think about #613?

@anton-johansson
Copy link
Author

I'll try to get the project set up locally and see what I can do. I'd guess "first day of the week" is the cleanest approach?

@anton-johansson
Copy link
Author

Won't be as easy as I initially thought! I looked too fast, arrayOfWeekdays is just for the labels. But I need to be able to specify those as well (I want to translate them in the appropriate language), so I might attempt to fix both of those issues in the same PR.

@aried3r
Copy link

aried3r commented Sep 7, 2021

@anton-johansson, in case #613 solves the problem of the first-day-of-the-week problem (I haven't checked out and run the code in the PR), translation for the calendar component should be doable using monthLegend (see docs). For example using the .toLocaleString() API or other Intl APIs, depending on which browsers you support.

I.e.:

const date = new Date()
const month = date.toLocaleString('it-IT', { month: 'long' });
console.debug(month) // Prints "settembre"

@stale
Copy link

stale bot commented Dec 6, 2021

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

@stale stale bot added the stale label Dec 6, 2021
@stale
Copy link

stale bot commented Dec 14, 2021

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants