Open danillouz opened 5 years ago
I obviously also have to document a lot of stuff still 🙂
Some of the questions that I thought we might have to answer.
My answer would be more focused on what we want to achieve with this calendar, so if I have to answer the questions above.
My opinion is to narrow the scope, so we can avoid logic that needs to deal with conflicting configurations. e.g. Selecting a date range that includes a non available date. Some of my answers could be easily solved though. e.g. (7) You could say that it's easy to use on of those.
I think it makes sense what you say to primarily focus on the behaviour we need. Meaning it's a date- time picker, so you should always pick a date and time. In the future these could potentially be configurable but I don't have a current use case for that (point 6
7
, 8
, 9
, 10
).
I also think some behaviour can be easily configured, like being able to select (past) dates or not. And what time slots to show. For example by passing "validor" functions or prop (point 1
, 2
, 4
, 5
).
The benefit of this is making the component more usable in other use cases, but this can be a slippery slope, so we should be vigilant and not go crazy here, unnecessarily complicating things. What I'm thinking now is have an API for:
For point 3
I think that's a nice way of doing it. Sane default with the option to change the timezone.
Although one thing to not here is that I think this setting is more for the "sanity" of the user (person using the picker). Because the timezone is less important when scheduling against specific slots, since you don't have to take someone else's time slot + time zone into account. (like with Calendly et all; does my local time slot overlap with the other's person local time slot). So do we actually need a time zone selector?
I've spent some time to see if I could create a basic calendar component. What I have so far can be seen here:
https://mooncake-react-date-time-picker-demo.netlify.com/
It's heavily inspired by Calendly 😅. I tried my best to reproduce a clean design, but my main goal was/is to create a functional date/time picker that looks decent enough. I think we should have someone with good design skills have a look at it, but for now I think it's good enough.
In terms of functionality, you can now only browse months and click on a day, which logs the date to the console. This is currently the "first step". The "second step" should be picking a time slot (with support for timezones etc.).
This should be an npm module at some point, but currently it's not. You can run it locally with
npm start
which uses Parcel to build a simple (demo) app. This is also used for the Netlify demo page.The
<DateTimePicker />
component doesn't accept any props at the moment. We should discuss the API, but I think there's at least passing acurrentDate
(i.e. to render the proper date in the picker) and avalidator
(i.e. to determine which days can be interacted with, e.g. to disable past dates). Additionally we should think about the best way to "get" the selected date/time data from this component, to be used in any parent. This could be as simple as passing some sort ofsetData
function prop, but other patterns are possible as well.But we can create issues for the stuff I mentioned and any other things as we work on/discuss it.