Open ended ranges
Greetings to Saturn Team!
I have evaluated your lib for use in our app, and unfortunately it didn't meet our needs. I wanted to provide feedback about our use case, so that it may perhaps be considered in future iterations.
We frequently need the ability to select open-ended date ranges. That is, a range that has no beginning, or a range that has no end. It is interpreted as "from the beginning of time until X date" if start date is omitted, or "from X date onward" if end date is omitted. Usually also though, we need the ability for the user to select both dates if they want.
Although Saturn offers a really neat feature for single-date selection, it wasn't able to fulfill our needs, because it displays the single date in both the from and to boxes upon dismissal.
If you would please consider developing that kind of functionality, I guess the UI would display colorized date ranges for all dates leading up to the end date, and all dates after the start date, without the need to have both. So, for example, if there was no start date, all dates would be highlighted up until the end date. And if there is no end date, all dates would be highlighted from the start date onward, without end.
I'm actually just not sure what the UX would be for selecting only an end date. Perhaps it would depend on which control the user initially clicked upon.
It would also be cool, if I could set a placeholder if one or both dates are undefined, such as "Open Ended", or "No Start Date" or "No End Date".
Hope that makes sense, and would really appreciate your feedback about that use case, and of course we would love to see a feature like that make it into a future version of Saturn-Datepicker lib.
:beer:
I appreciate for a such long explanation why need this feature. But it's a big feature, and I don't have time for this. But you can always make a pull request
I would second this feature, and I would argue it's a more common use-case than a fixed date range is.
An easy start that would get us halfway there would be to add an option similar to "select start date on close" that did the opposite, and instead of canceling and selecting nothing, selected { begin: D, end: null }.
9
@thomas-parrish you are right, it's may be easy. May be you make a pull request? :)
is it done yet or is someone working on that? If no I will work on that
@theonelucas No one working on that
I'm refactoring the calendar to accept almost all types of selection:
- Select a date;
- Select a date range;
- Select all dates from a given date until eternity;
- Select all dates from the beginning of time until a given date;
Only two selection types will be left outside:
- Select multiple dates;
- Select multiple date ranges;
They will be left outside due to the fact that I didn't come up with a simple design solution for selecting them. My question is: Given the image below, and the imaginable functionality it brings, do you thing this is a direction this project could evolve to or you think this is outside of scope for this repo? I would like to keep this functionality in this repo so we don't spam the internet with multiple copies of the same project just changing a small thing, as I've noticed a lot of other people did with this repo. But, I'm also willing to create a new repo if that's not the case, because I think this functionality is crucial for a lot of people.

Do you really accepting several ranges is crucial? Even if it is, I think it wouldn't be convient to use. And I think it's better for users to have several calendars for manipulating multiple ranges. What do you think?
I agree with you, that's one of the reasons, apart from the layout, for why I will not be releasing multiple date ranges for now. If someone in the future make a good case for it, then we can consider again (maybe), but not for now. I just wanted to highlight that only two selection types would be left behind with this change.
It's cool
For our use cases, this would be pretty much ideal! Great work ❤️ I guess we would need to be able to configure the toolbar. In most cases we would not want the Single Date selection to be available.
Yes, I'm configuring in a way that when defining the component you will pass an array as a prop indicating the possible selection types ie.:
...
public selectionTypes = ["range", "since", "until"]
...
...
[selectionTypes]="selectionTypes"
...
@theonelucas Don't forget about header component. Don't know it's important or not
@SaturnTeam what about header component?
Todo list:
- [x] Core functionality discussed here
- [x] API to enable/disable selection modes
- [x] API to indicate initial selection mode if no value is provided
- [x] Identify selection mode based on initial value
- [x] Fix lint errors
- [x] WIP Update README file containing the changes to the API + examples of the new functionality
Bugs:
- [x] Calendar with insufficient height
- [x] When opening the calendar the focus is being set on the current date instead of the range itself
- [x] Keep previous selection when switching from "range", "until" or "since" modes to "date" mode
- [x] When creating the calendar with a predefined "until" range the range is not being shown in the calendar
- [x] Do not show the mode selection buttons if there is only one selection mode available
Opened the PR #88 that satisfies this issue.