To whom it may concern,we are having some issues with the year end/year beginning and the calendar weeks during those weeks. In the 1st calendar week of the year 2015 (Days 29, 30, 31 of December 2014) the calendar week is numbered 53.However in the 53st week of the year 2015 (days 1, 2, 3 of January 2016) the calendar week is numbered 53, whereas the logic would dictate this week to be numbered 1.GetWeekNumberForDate is the function that seems to differ and vary, depending on the calendar year. Whereas the calendar control UltraDayView has the same logic display consistently. Could you please explain your ideas behind this? We are having rather large issues with each year end/ year beginning using your software and we are open to solutions, that will be consistent for the future.Best wishes,
A. Kasar
Hi Kasar,
I used the following code, and both weeks came out to be numbered week 1:
int wk1 = ultraCalendarInfo1.GetWeekNumberForDate(new DateTime(2015, 1, 1));int wk2 = ultraCalendarInfo1.GetWeekNumberForDate(new DateTime(2016, 1, 1));
I am using Infragistics 14.2, with the October service release.
Does your code look similar to mine? Are you nonetheless seeing different results?Are you using the same version and service release as me?
Please let me know which version and SR you are using and, if possible, provide some code that I can test. My testing seems to indicate that this method is behaving consistently, so I would like to be able to take a closer look at your application.
I am using the .NET Framework 4.0 and the Infragistics-versions Infragistics Windows Forms 2014.2.2010 & Infragistics WPF 2014.2.2024
I have used your example and the incorrect result keeps showing up.
Infragistics.Win.UltraWinSchedule.UltraCalendarInfo ultraCalendarInfo1 = new Infragistics.Win.UltraWinSchedule.UltraCalendarInfo();int wk1 = ultraCalendarInfo1.GetWeekNumberForDate(new DateTime(2015, 1, 1)); ==> 1int wk2 = ultraCalendarInfo1.GetWeekNumberForDate(new DateTime(2016, 1, 1)); ==> 53
I have reproduced this behavior in certain circumstances, and I believe it is correct. The result given by GetWeekNumberForDate depends on the CalendarInfo's FirstDayOfWeek and WeekRule properties. I have provided a sample that evaluates each combination, then prints the results if the week number is different. I have attached the sample to this post.
1/1/15 is week 1 and 1/1/16 is week 53 in two cases:
1) FirstDayOfWeek is Monday and WeekRule is FirstFourDayWeek. This is accurate because January 1st falls in the first four day week of 2015, but the first four day week of 2016 starts with January 4th.
2) FirstDayOfWeek is Thursday and WeekRule is FirstFullWeek. This is accurate because January 1st is a Thursday in 2015 and a Friday in 2016.
What are your settings for FirstDayOfWeek and WeekRule? WeekRule defaults to FirstDay, but FirstDayOfWeek's has a Default value that allows the control to defer to your system settings to determine the first day of the week. Are you able to modify these properties to get the behavior you need? Please refer to my sample to see the results of different rule combinations.
Thank you very much for your reply and your example provided. I am so sorry if my wording has been a little off and misunderstood, so I am trying to explain the problem at hand again. I have FirstDayOfWeek = Thursday and WeekRule = FirstFourDayWeek set.With these settings I need the SAME week for each weekday in one calendar week via the function GetWeekNumberForDate. As is shown in the picture and Control UltraMonthViewMulti (picture). At the moment I am getting for December 29th, 30th, 31st 2014 the calendar week 53 (in my opinion this is wrong, as I am expecting the week nr. 1, as the week 53 does not exist officially for the year 2014) and for January 1st, 2nd, 3rd, 4th 2015 I am getting calendar week 1 (this is correct) from the programming. The days of this last calendar week should be in the same number week (as expected) in order to work properly for my programming. Sincerely,A. Kasar
Correction: [...] I have FirstDayOfWeek = Monday and WeekRule = FirstFourDayWeek set. [...]
Is there anything further that I can do to assist you with this issue?
Our team has checked into the code for our CalendarInfo to find the cause of this issue. In our code, we are getting the week numbers directly from the .NET Framework.
If you believe that the week numbers are incorrect in the .NET Framework and you would like this to be corrected, I recommend submitting a bug to Microsoft. Microsoft accepts .NET Framework bug reports here: https://connect.microsoft.com/VisualStudio
Please let me know if there is anything further that I can do to help.
After taking another look at WinCalendarInfo with the new info you provided in mind, along with a bit of research on the official designation of week numbers, I believe that our component may be behaving incorrectly. I have asked our engineering staff to examine this further. To ensure that it will receive attention, I have logged this behavior in our internal tracking system with a Development ID of 185032. The next step will be for a developer to review my investigation and confirm my findings, or to offer a fix or other resolution.
I will leave this case open and update you with any new information after the review. You can also continue to send updates to this case at any time.
You can view the status of the development issue connected to this case by selecting the "Development Issues" tab when viewing this case on the web site.
Please let me know if you need more information.
Sincerely,Mike BowshewiczDeveloper, Windows Formshttp://ko.infragistics.com/