Skip to content
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

Why isn't same day min/max allowed? #182

Open
Voyz opened this issue Jul 6, 2017 · 1 comment
Open

Why isn't same day min/max allowed? #182

Voyz opened this issue Jul 6, 2017 · 1 comment

Comments

@Voyz
Copy link

Voyz commented Jul 6, 2017

I understand the purpose of rome.js / calendar selector is to select from within a range of days, and having only one day as an option makes the widget useless.

However, the problem I'm running into is that same Moment object can be used for rome.js and for time (hour/minute/etc.) selector. In such case the selection may sometimes be limited to one day, eg. between 8am and 11am. Rome.js will disallow such limits and forces me to duplicate one of the limit moments and move it by one day, in the end displaying an incorrect range to the user.

Lines 5085- 5087

if (o.max.clone().subtract(1, 'days').isBefore(o.min)) {
  throw new Error('`max` must be at least one day after `min`');
}

My question is: Is there anything really stopping rome.js from displaying only one day?

@MikesGlitch
Copy link

MikesGlitch commented Nov 25, 2020

I'm running into this issue as well - I'm trying to show only one day.

My situation is it's two date selectors that are ideally 28 days apart. In certain situations that wont be possible (like if there are only 2 days between the start and now), so I want to lock them in to that one day for the start date so the chart shows as close to 28 days of data as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants