Set date as tomorrow's date in datepicker

Hi there,

I have the following code which blocks out 3 days on my datepicker.

$('input[name="ddate"]').datepicker({
  dateFormat     : 'dd/mm/yy',
  minDate : '+3d'
});
    

However, the current datepicker script by default has todays date in the input field. I would like to display tomorrows date in the input field byt default when a user lands on the page.

How would I do this?

Thanks!

http://api.jqueryui.com/datepicker/#option-defaultDate

Thanks, I’ve tried the following, but it doesn’t seem to work:

$('input[name="ddate"]').datepicker({
  defaultDate: +70
});

My HTML is:

<input class="datepicker hasDatepicker" name="ddate" id="dp1478599263558" type="text">

what’s the error?

pro tip: “it doesn’t work” is not a useful error description.

2 Likes

Sorry, I meant that the date is not changing to the increased number of days in my above code

what does it do instead?

It’s setting the date to today’s date

I’m running the following in console and getting the following output:

$('input#dp1479210737880').datepicker({
  defaultDate: +7
});

Object[input#dp1479210737880.datepicker.hasDatepicker property value = “30/11/2016” attribute value = “null”]

Any ideas why it’s not changing the date to 7 days ahead?

Thanks for your help

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.