Date binding issue showing incorrect month.

2 posts, 0 answers
  1. Jacques
    Jacques avatar
    138 posts
    Member since:
    Jun 2007

    Posted 29 Nov 2013 Link to this post

    See the following HTML: 

    <input id="dateFor" data-role="datepicker" data-format="MMM yyyy" data-bind="value: dateFilter, events: { change: dateForChange }" class="bindable" />
    here's the viewModel: 

    var viewModel = kendo.observable({ dateFilter: new Date(2013,11,1)});
    kendo.bind($('.bindable'), viewModel);

    The resulting date picker shows the date as Dec 2013 in Firefox. IE and Chrome (didn't test Safari). 

    If you set the month to 12, it ignores the year value and jumps to Jan 2014. 

  2. Atanas Korchev
    Atanas Korchev avatar
    8462 posts

    Posted 29 Nov 2013 Link to this post

    Hello Jacques,

    In JavaScript the Date object has zero based months. Thus 11 represents December. More info is available here

    Integer value representing the month, beginning with 0 for January to 11 for December.

    Atanas Korchev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top