Akash Shah Akash Shah - 7 months ago 42
jQuery Question

xeditable defaultViewDate option for datepicker doesn't work

Any help would be appreciated I tried the below code for x-editable version 1.5.0 the other options like: 'weekStart' works but options like 'setDate', 'defaultViewDate' doesn't work is something wrong with my code?
My Code:

<a href="#" id="dob" data-type="date" data-pk="1" data-title="Select date">15/05/1984</a>

<script type="text/javascript>
format: 'yyyy-mm-dd',
viewformat: 'dd/mm/yyyy',
datepicker: {
weekStart: 1,
defaultViewDate: {
year: 2012,
month: 11,
day: 11


You can use data-value attribute in your HTML to set default date value

<a href="#" id="dob" data-type="date" data-value="2012-11-11" data-pk="1" data-title="Select date"></a>

this is a workaround check updated jsfiddel, Please up-vote if this helps.

If you want the data-value is empty the datepicker to open with default date. you can use defaultValue option of editable property.

    format: 'yyyy-mm-dd',
    viewformat: 'dd/mm/yyyy',
    url: '/post',
    defaultValue: "11/11/2012"

check example here http://jsfiddle.net/z0yqgL9k/6/