Skip to content
This repository has been archived by the owner on Dec 18, 2023. It is now read-only.

Only display single date if start and end date are the same #306

Open
josurzyn opened this issue Jul 1, 2022 · 0 comments
Open

Only display single date if start and end date are the same #306

josurzyn opened this issue Jul 1, 2022 · 0 comments

Comments

@josurzyn
Copy link

josurzyn commented Jul 1, 2022

If the start and end date are the same, it'd be great to have the option only show that date rather than the range.

Eg rather than showing 01/07/22 - 01/07/22, just 01/07/22 would look much neater in a lot of contexts 馃槑

This would be like the display when maxDays is set to one, but with users still able to select a larger range if they want to.

Context

We have a date picker which defaults to a single day selection, but users can select up to 7 days.

Alternatives

It's probably possible to hack something similar either by comparing dates outside the picker and setting the input value directly, or doing something hacky with the 'format' option, but it'd be much cleaner (and less error prone) to handle this directly inside the picker.

Would be very happy to hear any existing solutions if I've overlooked something 馃獎

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

No branches or pull requests

1 participant