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

allowInput flag misbehaving for editing date range #534

Closed
DChau10 opened this issue Jan 9, 2017 · 0 comments
Closed

allowInput flag misbehaving for editing date range #534

DChau10 opened this issue Jan 9, 2017 · 0 comments

Comments

@DChau10
Copy link

DChau10 commented Jan 9, 2017

Introduction

I want to use the following on my datetime range:

HTML

<input id="testpicker">

JS

flatpickr("#testpicker", {
  "mode":"range",
  "enableTime": true,
  "allowInput": true
})

Action: The user selects start date & start time, then stop date & stop time.
Alternatively, the dates could be programmatically set via defaultDate.

Expected Behavior

The user should be able to easily edit the currently selected date(time)s. The user should not have to scroll through the calendar months to find the date that they want to edit. If the start or stop date is 50 years in the future or 50 years in the past, it should be easy to set those values. Thus, we decide to utilize the allowInput flag so the user can modify a date via the input.

The user should be able to click on the input with a date range already selected, then be able to edit either of the dates via the input or the calendar.

Current Behavior

Attempting to edit a selected date(time) in the range results in a NaN. It seems to me as though allowInput was only implemented for single date(time) pickers, rather than the date(time) range picker.

Additionally, there is no way to edit a date(time) in the calendar. You currently have to re-select both start and stop. This may not be an acceptable solution for many, as this date range could have been populated by other means, and it may not always be the user's responsibility to edit both dates. This introduces more opportunity for user error, if they happen to forget the date(time) of the date that they aren't trying to update.

Possible Solution

See the bootstrap-daterangepicker project for ideas. Their approach has 3 inputs:

  1. The primary input that the user clicks on to spawn the editor window. This primary input can also be edited.
  2. The start date(time) input which can be edited and reflected in its calendar picker and time picker.
  3. The stop date(time) input which can also be edited and reflected in its calendar picker and time picker.
@chmln chmln closed this as completed in cf0265b Jan 9, 2017
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

1 participant