Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

set default on datepicker

Hi there,
is it possible to have todays date as default, unless clicked and another date selected

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

set default on datepicker

You should be able to do it via JavaScript. Get today's date and set it on page load.

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

set default on datepicker

Hi Max,
when you say via javascript is this what you mean

var current_date = new Date();
var dd = current_date.getDate();
var mm = current_date.getMonth()+1; //January is 0!
var yyyy = current_date.getFullYear();

also I notice in the new builder the datepicker shows on load NaN/NaN/NaN

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

set default on datepicker

Yes, something like this.

You get NaN/NaN/NaN -- when you use JavaScript or without it?

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

set default on datepicker

with and withoutMax, running the code above had no impact on new or old builder

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

set default on datepicker

any idea whats happening with this datepicker Max,
Still getting NaN on new builder, with or without any extra code, various codes had no effect
(could it not be default to display todays date as this has got to be the most used format, you cannot book anything for yesterday

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

set default on datepicker

Hello! Looks like a bug. We'll fix it.

fairways mc
Posts: 0
Joined: Thu Oct 18, 2012 6:21 pm

set default on datepicker

I am also getting it as well as no Javascript:alert() on success of service.

erichelgeson
Posts: 0
Joined: Thu Dec 13, 2012 3:32 am

set default on datepicker

Since this is the first hit in google i'm putting the full code i got working here
//set picker on load so it doesnt show NaN
var current_date = new Date();
var dd = current_date.getDate();
var mm = current_date.getMonth()+1; //January is 0!
var yyyy = current_date.getFullYear();

$('input[type="text"]').val(mm+"/"+dd+"/"+yyyy);

-----

//access elements of the date in some other code
var dateArray = $('input[type="text"]').val().split('/');
var mm = dateArray[0];
var dd = dateArray[1];
var yyy = dateArray[2];

Return to “Issues”