Тhe logic in the kendo.date.weekInyear() method
considers the Kendo Culture, which has been configured for the current page. It does not take into account the browser / machine culture. That is why, if you use different Kendo Culture (which is also responsible for the first day of the week configuration), you may end up with different results. Here you could find a small sample demonstrating that
. When using the bg-BG
culture, 1st of January 2017 will be reported to belong to the 52nd week of year 2016. With the default culture (en-US), it will be reported to belong to the 1st week of year 2017. The difference comes from the fact that the Kendo implementation follows the ISO-8601 standard
, according to which the first week of the year is the week that contains that year's first Thursday (='First 4-day week').
Therefore, for the Bulgarian culture, in which the first day of the week is Monday, 1st of January 2017 will be the last day of a week. That week will hold only one day from the year 2017. Therefore, it will be considered to belong to the previous year (2016) and it will be its last week.
The en-US culture, however, has Sunday as its first day. Therefore, 1st of January will belong to the week 1-7th January 2017. There are 7 days of the new year in that week (7 >= 4). That is why, it will be the first week of the year.
The first day of the week can be overridden by using the second parameter of the method call. This way, the following call:
Date(2017, 0, 1), 0);
will always return 1, independent from the Kendo Culture that is being used.
Get quickly onboarded and successful
with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.