jQWidgets Forums

jQuery UI Widgets Forums Editors DateTimeInput Set the wrong Date

This topic contains 1 reply, has 2 voices, and was last updated by  Peter Stoev 11 years ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Set the wrong Date #55201

    tompasto
    Participant

    Hello,

    I’m setting some range or single dates from a string. The problem is that jqx add or remove randomly one day to the date i set.
    Here a video with the problem: https://www.youtube.com/watch?v=fnNklVwtDz4

    Here my code sample:

    function addTableRow(TableName,Dates)
    {
    var i=parseInt($(“#addTableRow”).val());

    if(TableName==’TableDaysOffrange’){
    var jqname=”daysoffrange”+i;
    $(“#”+TableName).append(“<TR><TD><div id='”+jqname+”‘></div></TD><TD >Modifier dates session<span>Supprimer cette plage.</span></TD>”);
    $(‘#’+jqname).jqxDateTimeInput({formatString: ‘yyyy-MM-dd’, width: 240, height: 25, selectionMode: ‘range’,theme: ‘Salud’ });
    if(Dates!=’0′){
    var range=Dates.split(“@”);
    alert(‘range0=’+range[0]+’range1=’+range[1]);
    $(‘#’+jqname).jqxDateTimeInput(‘setRange’, range[0], range[1]);
    }
    }

    if(TableName==’TableDaysOff’){
    var jqname=”daysoff”+i;
    $(“#”+TableName).append(“<TR><TD><div id='”+jqname+”‘></div></TD><TD >Modifier dates session<span>Supprimer cette plage.</span></TD>”);
    $(‘#’+jqname).jqxDateTimeInput({formatString: ‘yyyy-MM-dd’, width: 140, height: 25, theme: ‘Salud’ });
    if(Dates!=’0′){

    $(‘#’+jqname).jqxDateTimeInput(‘val’,Dates);
    }
    }

    i=i+1;
    $(“#addTableRow”).val(i);
    }

    Set the wrong Date #55212

    Peter Stoev
    Keymaster

    Hi tompasto,

    To set a Date, you should pass a JavaScript Date Object. For more information about JavaScript Date Object, see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date. If you pass a String instead of JavaScript Date object, then make sure that you will have to take into account the TimeZone and Daylight offset as well.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.