Skip to content
This repository has been archived by the owner on Sep 13, 2021. It is now read-only.

Open ended ranges #70

Open
FirstVertex opened this issue Feb 25, 2019 · 15 comments
Open

Open ended ranges #70

FirstVertex opened this issue Feb 25, 2019 · 15 comments
Labels
enhancement New feature or request

Comments

@FirstVertex
Copy link

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.

🍺

@SaturnTeam SaturnTeam added the enhancement New feature or request label Feb 26, 2019
@SaturnTeam
Copy link
Owner

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

@thomas-parrish
Copy link

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

@SaturnTeam
Copy link
Owner

@thomas-parrish you are right, it's may be easy. May be you make a pull request? :)

@theonelucas
Copy link

is it done yet or is someone working on that? If no I will work on that

@SaturnTeam
Copy link
Owner

@theonelucas No one working on that

@theonelucas
Copy link

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.

image

@SaturnTeam
Copy link
Owner

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?

@theonelucas
Copy link

theonelucas commented May 16, 2019

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.

@SaturnTeam
Copy link
Owner

It's cool

@FirstVertex
Copy link
Author

FirstVertex commented May 16, 2019

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.

@theonelucas
Copy link

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"
...

@SaturnTeam
Copy link
Owner

@theonelucas Don't forget about header component. Don't know it's important or not

@theonelucas
Copy link

@SaturnTeam what about header component?

@theonelucas
Copy link

theonelucas commented May 20, 2019

Todo list:

  • Core functionality discussed here
  • API to enable/disable selection modes
  • API to indicate initial selection mode if no value is provided
  • Identify selection mode based on initial value
  • Fix lint errors
  • WIP Update README file containing the changes to the API + examples of the new functionality

Bugs:

  • Calendar with insufficient height
  • When opening the calendar the focus is being set on the current date instead of the range itself
  • Keep previous selection when switching from "range", "until" or "since" modes to "date" mode
  • When creating the calendar with a predefined "until" range the range is not being shown in the calendar
  • Do not show the mode selection buttons if there is only one selection mode available

@theonelucas
Copy link

Opened the PR #88 that satisfies this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants