najlepsiwebdesigner / foundation-datepicker

Foundation datepicker jQuery plugin
http://foundation-datepicker.peterbeno.com
Apache License 2.0
442 stars 269 forks source link

format:'mm/dd/yyyy' does not format initial value of form field #246

Open amityweb opened 5 years ago

amityweb commented 5 years ago

When using date picker in an edit form field, the field value does not honour the format:'mm/dd/yyyy' setting. When you click the field to open date picker, and then click off it to close it, it does change the format then.

So this field displays the value as 2019-09-23 even though format format: 'dd/mm/yyyy' is used. <input type="text" id="startDate" name="fields[startDate]" class="date-picker" value="2019-09-23">

    // Date Picker Fields
    if( $('.date-picker').length > 0 )
    {
        $('.date-picker').fdatepicker({
            format: 'dd/mm/yyyy',
            disableDblClickSelection: true,
            leftArrow:'<<',
            rightArrow:'>>',
            closeIcon:'X',
            closeButton: true

        });
    }