Click here to Skip to main content
15,889,863 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my project I use the MonthCalendar-Control in vb.net. I use the .showWeekNumber property of the control.

I now noticed that there is an error in the week numbers in year 2016. Each week number is 1 number too high:
When I look at the MonthCalender-Control and view December 2015 and also Jannuary 2016 then I see that one week hast two week-numbers!

in December 2015, starting with 2015-12-28, there is shown week number 53
in Jannuary 2016, the same week has the number 1

So the result is that all weeks in 2016 are counted wrong. It seems that this is an error in the dotNet-Framework. I have no idea how to correct this.

Has anyone suggestions?
Posted

It may be your result that is wrong. Are you sure you are computing this number as per ISO 8601 week date[^]?
 
Share this answer
 
Comments
brixharry 9-Oct-15 3:06am    
Well, look at this:

iso 8601 says the first week is the week containing the first Thursday of a year. In 2016 the first Thursday is Jannuary 7th. So, according to this, week 1 begins with Jannuary 4th.

in dotNet Framework week 1 begins with December 28th in 2015. So week 2 begins with Jannuary 4th 2016. And this ist not what iso 8601 says.
phil.o 9-Oct-15 5:22am    
Ok, that was just to be sure. Unfortunately I can't see what is going on. Maybe there's a builtin bug?
Seems a bit like this. Bu have a look at outlook 2010. There you can set how to calculate the first week of a year in the settings of outlook-calendar-options. Options for first week are:
- week containing Jannuary 1st
- first full week
- first week with 4 days of the new year (this is iso 8601)

So supposing that outlook uses the same monthCalendar-control there seems to be an undocumented property of the control where you can set exactly this. But how to get this property?
 
Share this answer
 
Comments
Bib34770 19-Nov-15 9:52am    
we have the same problem, if you find a solution please publish...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900