This is a migrated thread and some comments may be shown as answers.

Problem setting date on client

3 Answers 55 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
FierceMuppet
Top achievements
Rank 1
FierceMuppet asked on 16 Jan 2009, 03:58 PM
Here is the code that I am using.

var cal = $find("<%= calDueDate.ClientID %>"); 
if (getElement("txtDueDate").value != ""){ 
var d = Date.parse(getElement("txtDueDate").value); 
cal.set_selectedDate(d); 
 

I am getting the following error in Firefox: Error: _43.getFullYear is not a function

I have tried using the value without a date parse.  Either way, gives me the same error.

3 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 16 Jan 2009, 06:22 PM
Hello Andy,

In order to give you a better explanation for this error I suggest you test the following code locally:
var d = Date.parse("01/01/01"); 
var e = new Date("01/01/01"); 
alert(d + "\n" + e); 

Let me know whether this helps.

Best regards,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
FierceMuppet
Top achievements
Rank 1
answered on 16 Jan 2009, 07:37 PM
I was able to fix the problem, although you could have been more clear on how to get the date value. (i.e. the second method you put in the example)
0
Nicolaï
Top achievements
Rank 2
answered on 01 Oct 2009, 07:53 AM
Oh, thanks Daniel..! I had nightmares of this error, and this js fixed me..!

edit: actually I had to move away from that... (Opted for standard dateinput without calendars:set_value,get_value)
Parsing dates on client side is problematic, since it depends on the users time zone?
Some dates were being read as UTC+2, giving me 29/09/09 22:00 on the server instead of 30/09/09 (inputted value).
And I have users on both sides of the sea...
Tags
Calendar
Asked by
FierceMuppet
Top achievements
Rank 1
Answers by
Daniel
Telerik team
FierceMuppet
Top achievements
Rank 1
Nicolaï
Top achievements
Rank 2
Share this question
or