-
Notifications
You must be signed in to change notification settings - Fork 1
Adding support for start of week day in "Week view". #7
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
base: main
Are you sure you want to change the base?
Conversation
If the prop is not provided, it starts from Sunday, keeping the previous behaviour
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In place of explicitly mentioning "Mon" | "Tue" | "Wed" | "Thu" | "Fri" | "Sat" | "Sun" everywhere, create a enum for that in calendar.ts file, then you can use it here like
On top -
import type { CalendarEvent, Weeks } from "@/types/calendar";
startOfWeek: Weeks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can use the Weeks enum here as well
On top -
import type { CalendarEvent, Weeks } from "@/types/calendar";
startOfWeek = Weeks.SUNDAY,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create a enum for Weeks here, reference below -
export enum Weeks {
MONDAY = "Mon",
TUESDAY = "Tue",
WEDNESDAY = "Wed",
THURSDAY = "Thu",
FRIDAY = "Fri",
SATURDAY = "Sat",
SUNDAY = "Sun",
}
Then everywhere -
startOfWeek?: "Mon" | "Tue" | "Wed" | "Thu" | "Fri" | "Sat" | "Sun"; --> startOfWeek?: Weeks;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same goes for here - startOfWeek?: Weeks;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same goes for here - startOfWeek ?? Weeks.SUNDAY
|
Hey @gustalima 👋, Thank you so much for this contribution — I really appreciate you not only using the project but also taking the time to open an issue and follow it up with a PR! 🎉 It’s always exciting (and honestly a bit overwhelming in a good way 😄) to see the community grow and contribute actively. Your change to allow setting a fixed starting weekday is a great addition and will definitely help others looking for more control over the calendar view. Would love to know — how are you using this project? Has it been integrated into something you’re building or working on? Always curious to see the real-world use cases it’s helping with. 😊 Looking forward to more contributions and discussions from you in the future. Thanks again! 🙌 Best, |
|
Hi @yasirmansoori, Thanks for your comments on the PR. I'm new to TS, and I have learned from your review. I will make the changes. On my forked version, I changed the Month and Year view so it can use startOfWeek too (greying out days from previous/past months). I will clean that up and create a second PR. I'm trying to add an experiment scheduler for one of the apps I have at work, and Eventar was the only suitable option I've found. I need multiple booking providers with different colours (the resources in Eventar's case). As everything else in my company uses MUI, I'm porting it to MUI v7. Cheers, |
|
Hi @gustalima, Thanks a lot! I’m really glad Eventar has been useful in your project. Excited to see your upcoming PR and commits. Let me know if you need any help. Cheers, |
If the prop is not provided, it starts from Sunday, keeping the previous behaviour.