atais / ng2-eonasdan-datetimepicker

A wrapper directive around the Eonasdan Datepicker v4 component.
MIT License
34 stars 23 forks source link

How to dynamically restrict date range when using 2 date pickers #28

Closed albertStaalburger closed 6 years ago

albertStaalburger commented 6 years ago

With the eonasdan-datetimepicker you could update the max and min of a date picker by simply doing this:

.on("dp.change", function (e) {
    if (e.date) {
        $('#returnDatePicker').data("DateTimePicker").minDate(e.date.add(1, 'days'));
    }
});

With angular, I have tried both the jQuery above, which causes all kinds of madness as well as adding a setMin() method to the date picker options object.

Alas, none of those work.

Is this something that can be done? If so, am I missing something?

albertStaalburger commented 6 years ago

Here is a simple plunker of what i have tried: https://plnkr.co/edit/9ZrYdxJIGkX5MvWlU079?p=preview

fetrarij commented 6 years ago

@albertStaalburger This is so easy with the new release https://embed.plnkr.co/5RsdBGbpz77sx5wPRGCy/