This is a migrated thread and some comments may be shown as answers.

Date binding issue showing incorrect month.

1 Answer 141 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
Jacques
Top achievements
Rank 2
Jacques asked on 29 Nov 2013, 06:31 AM
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)});
 
//bind
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. 

Regards,
Jacques

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 29 Nov 2013, 07:55 AM
Hello Jacques,

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

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


Regards,
Atanas Korchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
MVVM
Asked by
Jacques
Top achievements
Rank 2
Answers by
Atanas Korchev
Telerik team
Share this question
or