jQWidgets Forums

jQuery UI Widgets Forums Scheduler The date of the month shows one month ahead

This topic contains 1 reply, has 2 voices, and was last updated by  Yavor Dashev 3 years, 8 months ago.

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

  • walansari
    Participant

    I am a beginner to use Scheduler .

    var appointments = new Array();
    var appointment1 = {
    id: “id1”,
    description: “George brings projector for presentations.”,
    location: “”,
    subject: “Quarterly Project Review Meeting”,
    calendar: “Room 1”,
    start: new Date(2021, 10, 23, 9, 0, 0),
    end: new Date(2021, 10, 23, 16, 0, 0)
    }

    Registration in the month of 10
    But it appears in the month of 11.

    http://bayttech.net/anwar/test.html

    The date of the month shows one month ahead #120760

    Yavor Dashev
    Participant

    Hi walansari,

    This behavior is not because of the jqxScheduler, its is caused by the way the Date object works in JavaScript- the important thing is that the month`s starting index is 0.
    Docs regarding the Date constructor: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date

    This means that if you want to display the appointment in October you will have to set the date like so:

     var appointments = new Array();
    
                var appointment1 = {
                id: "id1",
                description: "George brings projector for presentations.",
                location: "",
                subject: "Quarterly Project Review Meeting",
                calendar: "Room 1",
                start: new Date(2021, 9, 23, 9, 0, 0),
                end: new Date(2021, 9, 23, 16, 0, 0)
                }

    Let me know what you think!

    Please, do not hesitate to contact us if you have any additional questions.

    Best Regards,
    Yavor Dashev
    jQWidgets team
    https://www.jqwidgets.com

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

You must be logged in to reply to this topic.