Page 1 of 1

set default on datepicker

Posted: Thu Nov 15, 2012 6:53 pm
by Michael4771079

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


set default on datepicker

Posted: Thu Nov 15, 2012 10:24 pm
by maxkatz

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


set default on datepicker

Posted: Fri Nov 16, 2012 7:54 pm
by Michael4771079

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


set default on datepicker

Posted: Fri Nov 16, 2012 8:45 pm
by maxkatz

Yes, something like this.

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


set default on datepicker

Posted: Fri Nov 16, 2012 9:03 pm
by Michael4771079

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


set default on datepicker

Posted: Sun Nov 18, 2012 8:13 pm
by Michael4771079

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


set default on datepicker

Posted: Mon Nov 19, 2012 11:40 am
by Maryna Brodina

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


set default on datepicker

Posted: Mon Nov 19, 2012 11:42 pm
by fairways mc

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


set default on datepicker

Posted: Sat Dec 15, 2012 8:35 pm
by erichelgeson

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];