jquery-date-range-picker icon indicating copy to clipboard operation
jquery-date-range-picker copied to clipboard

Allow independent start date / end date updates when working with two fields

Open fglueck opened this issue 10 years ago • 6 comments

When working with two fields for start/end dates, the user always has to select both dates when opening the datepicker. It would be a better user experience to let them edit only the start date or the end date, depending on which input they trigger the datepicker from.

fglueck avatar Sep 04 '15 09:09 fglueck

@fglueck Could you solve this? I am facing the same problem right now.

JSchwehn avatar Dec 02 '15 12:12 JSchwehn

I have the same problem. Is there already a solution?

ChristopherSchaefer avatar Oct 25 '16 11:10 ChristopherSchaefer

Is there already a solution?

mijrs avatar Feb 02 '17 13:02 mijrs

Found a work around solution for this.

$('#date-range-second-field').focus(function(){
        var start = $('#date-range-first-field').val();

        $('#two-inputs').data('dateRangePicker').clear();
        $('#two-inputs').data('dateRangePicker').setStart(start);
        $('#date-range-first-field').val(start);
});

aaronkzhou avatar Apr 04 '18 23:04 aaronkzhou

Do you have a jsFiddle that can demonstrative this?

yphoenix avatar Apr 05 '18 05:04 yphoenix

As demonstrated by @aaronleslie, there is a workaround. However, it depends on the focus event, which can cause edge cases. It also doesn't fix the case with the end date being set and updating the start date (although a similar workaround can be made for that case as well). I'm keeping this issue open as a feature request.

monovertex avatar Sep 19 '18 19:09 monovertex