Problem setting date on client

4 posts, 0 answers
  1. FierceMuppet
    FierceMuppet avatar
    33 posts
    Member since:
    Dec 2006

    Posted 16 Jan 2009 Link to this post

    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.
  2. Daniel
    Admin
    Daniel avatar
    4949 posts

    Posted 16 Jan 2009 Link to this post

    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.
  3. FierceMuppet
    FierceMuppet avatar
    33 posts
    Member since:
    Dec 2006

    Posted 16 Jan 2009 Link to this post

    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)
  4. Nicolaï
    Nicolaï avatar
    160 posts
    Member since:
    Apr 2008

    Posted 01 Oct 2009 Link to this post

    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...
Back to Top