jQuery UI Widgets Forums Editors Calendar Adding dates to next month in SpecialDate calender

This topic contains 4 replies, has 3 voices, and was last updated by  Amadeu 11 years, 6 months ago.

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

  • Amadeu
    Member

    Hello,
    Is it possible to add special dates with the SpecialDate calendar not only in the current months but for the forecoming months too. I’m a newby with javascript and I can’t figure out how. I think it should be something like that:

    var date1 = new Date();
    var date2 = new Date();
    var date3 = new Date();
    date1.setDate(1/12/2011);
    date2.setDate(1512/2011);
    date3.setDate(1612/2011);

    But, obviously, it’s no working.

    Thanks in advance for your attention.
    Best regards.


    Peter Stoev
    Keymaster

    Hi Amadeu,

    Thank you for writing us.

    The setDate method of the Date object sets the Day part of the Date only.

    To add a special date, you can use the following code:

              var date1 = new Date(2011, 11, 20); 
    // Add special dates by invoking the addSpecialDate method.
    $("#jqxWidget").jqxCalendar('addSpecialDate', date1, '', 'Special Date1');

    The above code adds a special date which is year: 2011, month: december, day: 20

    Hope this helps you.

    Please feel free to write us, if you have any additional questions.

    Best Regards,
    Peter Stoev


    gabrielkolbe
    Member

    probably 2011, month: November, day: 20


    Peter Stoev
    Keymaster

    Hi gabrielkolbe,

    The date is: year: 2011, month: december, day: 20 because the month number in the Date object starts from 0 to 11, not from 1 to 12 i.e 0 is January, 1 is February, etc.
    It was confusing for me, too when I first used the JavaScript’s Date object.

    Best Regards,
    Peter Stoev


    Amadeu
    Member

    Thanks for your helpfull response, Peter and Gabriel.
    Best regards,
    Amadeu Sanz

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

You must be logged in to reply to this topic.