jQuery UI Widgets Forums Editors DateTimeInput setDate returns worng value


This topic contains 1 reply, has 2 voices, and was last updated by  admin 2 years, 1 month ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • setDate returns worng value #101352


    This displays 2018-08-02. Why……

    $(‘#INACTIVE’).jqxDateTimeInput(‘setDate’, new Date(‘2018-08-03’));

    Then this displays 2018-09-03. Why…..

    $(‘#INACTIVE’).jqxDateTimeInput(‘setDate’, new Date(‘2018-08-03 00:00));

    setDate returns worng value #101359


    Hi CXXXV,

    Date objects in javascript are in local time zone i.e when you create a date object from string, the day could be +-1 and the month could be +-1 if the day is the first/last day of the month and it’s incremented/decremented depending on the time zone. Same is valid for the year if it’s first, last month, day is first/last and the time zone difference changes the day. Well, in general the rule is that a JS Date object is always in the local time zone when it’s created from a String and our component displays the Result in Local Time Zone, too. jqxDateTimeInput works with local time zone, too, because it works internally with Javascript Date Objects. For example: http://jsfiddle.net/28ovhqxe/, displays in the DateTimeInput “03/08/2018” in my timezone which is EET with daylight saving. By setting 2018-08-03 00:00 displays the same in my time zone, too. This result is with the latest version of jQWidgets.

    Best Regards,
    Peter Stoev

    jQWidgets Team

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

You must be logged in to reply to this topic.