Non required date field doesnot show clear button

Idea created by Avinash Singh on Aug 1, 2017
    Active
    Score5
    • Avinash Singh

    Hi,

     

    We observer that a non-required date field does not show clear button but the required date field shows a clear button. 

    It should be other way round.

    We checked the SDK code and found that the code written in app/js/fields/date/date.js under toggleControls is having this problem.

     

    toggleControls: function() {
            var isEmptyValue = _.isEmpty(this.getValue());
            this.input.toggleClass('empty', Boolean(this.def.required && isEmptyValue));
            this.clearButton.toggle(Boolean(this.def.required && !isEmptyValue));
            if (this.def.required && this.placeholder) {
                this.placeholder.toggle(isEmptyValue);
            }
        },

    On line number 4 it should be 

    this.clearButton.toggle(Boolean(!this.def.required && !isEmptyValue));
           

    Joe Mao