mdehoog / Semantic-UI-Calendar

Calendar module for Semantic UI
MIT License
805 stars 127 forks source link

'clear' behavior doesn't unset shaded range in popup #65

Open tirdadc opened 7 years ago

tirdadc commented 7 years ago

I currently have a setup with two fields, #start_date and #end_date.

When selecting a start date, I set the end_date's start date using set startDate, and vice versa for the end date field.

I am trying to clear all these settings with this code, but it still shows shading in the calendar popup after all of these steps:

$('#start_date').val('');
$('#end_date').val('');

$('#start_date').calendar('clear');
$('#start_date').calendar('set endDate', undefined);
$('#start_date').calendar('set focusDate', undefined);
$('#start_date').calendar('refresh');

$('#end_date').calendar('clear');
$('#end_date').calendar('set startDate', undefined);
$('#end_date').calendar('set focusDate', undefined);
$('#end_date').calendar('refresh');

I expect this for my start date calendar popup when I reset these things:

screen shot 2017-03-29 at 2 21 50 pm

but I end up with this:

screen shot 2017-03-29 at 2 22 07 pm

What's missing? Neither set focusDate nor clear seem to do what I need them to do here.

mdehoog commented 7 years ago

Your example code works for me, see https://jsbin.com/lasoqomose/edit?html,js,output. Could you please provide a JSBin that reproduces the issue?