Comments (9)
That is correct @stingrayfunk you can only have one mode of the time. We are open to other approaches, though I am curious as to how you see a mixed mode version working? When a user selects a date, in range mode we then wait for them to select another date. In single mode one date is enough. How would a mixed version know when the date selection is complete?
from react-daterange-picker.
Thanks for the quick reply! I imagine it working like this:
The calendar would behave like it currently does for single mode. Then after the first date is clicked, the light outlines appear as they do in range mode. If they click a 2nd date, this range is selected, like in range mode. If they don't click a 2nd date, they still have their single selection. It's basically the existing range functionality, but allowing one date to be enough.
Make sense?
from react-daterange-picker.
Ok I guess that makes sense but I'm not sure we want to add more logic to what is already quite complicated. Maybe a good compromise is to add some more callbacks that get fired when the first date is selected and the second etc and then you can define what the logic is outside the component?
One caveat is that in range mode, when you've selected a date and it's waiting for the next date, hovering over the pagination arrows causes the view to move to the next month. This is expected behaviour but may interfere with the single selection paradigm.
from react-daterange-picker.
If we take the compromise of callbacks, the problem is usability. In range mode, when a date is selected, the user moves the mouse and sees that a 2nd date is expected (first date doesn't look fully selected). They don't have a visual cue that they've completed a date selection, unless the callback manually updates the colour of the date cell, but that seems like a hack.
No problem if my suggestion complicates the existing implementation in its current form. I haven't looked at the code yet so I couldn't comment on that.
from react-daterange-picker.
Could we allow a double on the same date? I would love if it allows this and return the same date for "start date" and "end date"..
Also as range pattern, we click a "start date" and "end date". It would be intuitive I feel. What do you guys think about this?
from react-daterange-picker.
Thanks, yes, agreed. Surely it just needs to return either one date (implies single selection), or two dates (implies range selection). Look at the way Kayak does it: http://www.kayak.co.uk/flights. For return flights, range selection, for one way flights, single selection. This is what I'm proposing for react-daterange-picker, only in one mode. There's no need to distinguish between single and range selection in terms of instantiating the React component. Unless I'm missing something? You could force each specific mode if you need to, but I think dual mode should be available too.
from react-daterange-picker.
@stingrayfunk @RohithVishwanath interesting idea that we hadn't thought of before. @AndrewIngram is going to be doing a lot of work on the datepicker this coming week, building on feedback we got from usertesting so we'll add this to the mix as well. Stay tuned!
from react-daterange-picker.
I'm not sure I understand the Kayak example. The way Kayak seems to work is the same as what's already possible, because you select single vs return before date selection.
Ultimately it's a UI issue, with a sprinkling of being a data issue. On the data side, I generally think of datepickers as being ridiculously elaborate enhancements of regular form inputs, which to me means there's an inherent contract as to what data type (in this case date, or date range) should be returned. Obviously we don't need to be quite so draconian, we can let you use the picker however you like, so I'm mostly going to treat this as a UI problem.
For context, i'd like to highlight that from our experiences with user testing, making a usable range picker is actually quite hard. There's a surprising number of use cases to cover, and if you look around at the various websites that use them (usually travel or analytics companies), there's a real lack of consistency. When you throw in our requirement to be able to block out ranges of dates as being un-selectable, it's even nastier.
So for this particular issue of allowing selection of a single date in range mode...
What does a user do to select a single date? I'm assuming they either select the same date twice, or somehow bail out after the first date is selected. The second one is already possible to do now that we have an event firing after the first date is selected. I don't know if we'd implement it in the component itself because the bail out process seems to be down to how you've chosen to use the picker (eg there's a difference between having it in a popover, to having it inline in the page).
The first one (selecting the same date twice) would work on a technical level, but has issues with affordance. How do you make it obvious that it's possible without flooding the UI with instructions on how to use it? From our own testing, we've realised that when it comes to implementing a custom UI widget, you can't assume anything will be obvious.
In the short term, we can just look into making it possible to select a range with length 0, ie start and end are the same, then it'll be up to you to decide what that actually means .
from react-daterange-picker.
I agree with @AndrewIngram and giving the same date for start and end makes sense. The using component can figure it out what it mean.
from react-daterange-picker.
Related Issues (20)
- Select Y or M after init Picker HOT 1
- Displayed range presumes selecting dates from future rather than past
- Today cell highlight HOT 1
- Please update the following components: CalendarDate, CalendarMonth, DateRangePicker, PaginationArrow HOT 1
- Custom icon for Pagination HOT 1
- How to Close calendar on date selection?
- unavailable dates shows half days on the calendar
- How to select only single day ? HOT 1
- Update moment-range to latest version 4.0.2
- SelectionType='single' and DateRange value HOT 1
- How to clear a particular selected range?
- How to localize month labels
- dependency limited to react 16.x HOT 2
- on outside click of calendar POPUP should close
- hi.. I need to show half a day selection in my project - half a day morning/evening.
- hi.. I need to show half a day selection in my project - half a day morning/evening. On passing a date, its highlighting the date partially below. How to highlight the date partially above?
- half a day selection issue
- Closing modal to reset date selection
- [Mobile view] Scrolling date picker using touch behavior also selects date
- OnSelect didn't work with onSelectStart
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-daterange-picker.