Discussion:
datePicker v2: setStartDate() is not a function?
Chris W. Parker
2007-05-18 18:41:34 UTC
Permalink
Hello,

I'm trying to implement datePicker v2 but Firebug says
"$('#date').setStartDate is not a function". I must be missing something
simple because I can click "calendar" and have the calendar appear. So
it works, just not completely. Any ideas where I'm going wrong?

Relevant code is at the end.



Thanks!

Chris.


HTML:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>datePicker test</title>
<link rel="stylesheet" type="text/css"
href="lib/css/jquery.datePicker-v2.css"/>

<script type="text/javascript"
src="lib/js/jquery-1.1.2.compressed.js"></script>

<script type="text/javascript"
src="lib/js/datePicker-v2/date.js"></script>
<script type="text/javascript"
src="lib/js/datePicker-v2/dimensions.js"></script>
<script type="text/javascript"
src="lib/js/datePicker-v2/jquery.datePicker-v2.js"></script>

<script type="text/javascript" src="lib/js/custom2.js"></script>
</head>

<body>

<p id="date">calendar</p>

</body>

</html>

custom.js:

// datePicker v2 stuff
Date.firstDayOfWeek = 7;
Date.format = 'mm/dd/yyy';

$(document).ready(function () {

// Kelvin Luck's datePicker v2
$('#date').datePicker();
$('#date').setStartDate('01/01/2006');

});
Jean Nascimento
2007-05-18 18:44:00 UTC
Permalink
Even pass in parameters is right =/
i´m with same problem for that i still have the old version lol
Post by Chris W. Parker
Hello,
I'm trying to implement datePicker v2 but Firebug says
"$('#date').setStartDate is not a function". I must be missing something
simple because I can click "calendar" and have the calendar appear. So
it works, just not completely. Any ideas where I'm going wrong?
Relevant code is at the end.
Thanks!
Chris.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>datePicker test</title>
<link rel="stylesheet" type="text/css"
href="lib/css/jquery.datePicker-v2.css"/>
<script type="text/javascript"
src="lib/js/jquery-1.1.2.compressed.js"></script>
<script type="text/javascript"
src="lib/js/datePicker-v2/date.js"></script>
<script type="text/javascript"
src="lib/js/datePicker-v2/dimensions.js"></script>
<script type="text/javascript"
src="lib/js/datePicker-v2/jquery.datePicker-v2.js"></script>
<script type="text/javascript" src="lib/js/custom2.js"></script>
</head>
<body>
<p id="date">calendar</p>
</body>
</html>
// datePicker v2 stuff
Date.firstDayOfWeek = 7;
Date.format = 'mm/dd/yyy';
$(document).ready(function () {
// Kelvin Luck's datePicker v2
$('#date').datePicker();
$('#date').setStartDate('01/01/2006');
});
--
[]´s Jean
www.suissa.info

Ethereal Agency
www.etherealagency.com
Kelvin Luck
2007-05-20 16:59:44 UTC
Permalink
Post by Chris W. Parker
Hello,
I'm trying to implement datePicker v2 but Firebug says
"$('#date').setStartDate is not a function". I must be missing something
simple because I can click "calendar" and have the calendar appear. So
it works, just not completely. Any ideas where I'm going wrong?
...
Post by Chris W. Parker
// datePicker v2 stuff
Date.firstDayOfWeek = 7;
Date.format = 'mm/dd/yyy';
$(document).ready(function () {
// Kelvin Luck's datePicker v2
$('#date').datePicker();
$('#date').setStartDate('01/01/2006');
});
Hi,

It seems like you are looking for dpSetStartDate. In fact, to achieve
what the code above does you can do this:

$('#date').datePicker({startDate:'01/01/2006'});

If you need to changed the start date after the date picker has been
initialised for any reason (like for example in my "Start and end date
pickers" example) then you will need to use dpSetStartDate like so:

$('#date').dpSetStartDate('01/01/2006');

Since the date picker methods are added to all jQuery methods I thought
it polite to prefix them to avoid naming collisions with other plugins.

Ahh - I've just noticed that there was a typo in the documentation which
is maybe why you got confused... I just fixed it (
http://dev.jquery.com/changeset/1930 ) and the documentation (
http://kelvinluck.com/assets/jquery/datePicker/v2/demo/documentation.html
) is now correct,

Thanks,

Kelvin :)
Chris W. Parker
2007-05-21 16:11:52 UTC
Permalink
Post by Kelvin Luck
Since the date picker methods are added to all jQuery methods I
thought it polite to prefix them to avoid naming collisions with
other plugins.
Ahh - I've just noticed that there was a typo in the documentation
which is maybe why you got confused... I just fixed it (
http://dev.jquery.com/changeset/1930 ) and the documentation (
http://kelvinluck.com/assets/jquery/datePicker/v2/demo/documentation.htm
l
Post by Kelvin Luck
) is now correct,
Thanks Kelvin!

Loading...