Monday 29 October 2012

AX 2012 client calendar lookups are not taking local system regional setting


We had seen a strange design change in AX 2012 Client calendar lookups.
To give you a brief, up till AX 2009 we AX client Calendar will be taking the local client system setting
Mean to say if we go to windows>> change date and time settings and change the first day of the week as Monday. My expectation , or I would like to put it this way , In AX 2009 if I do this modification and open my Ax client and then go to any of the date field and click Calendar lookup then I should be able to see the calendar for this month starting with day as Monday.
But unfortunately this behavior is not the same in AX 2012 even if we change the regional settings AX client will not take this in to consideration when it is showing calendar lookup. As below
 
The reason for this behavior change is because of the code modification in following class.
\Classes\Global\firstDayOfWeek
Existing code take this information based on DateTimeFormat Info of System.Globalization.DateTimeFormatInfo from assembly mscorlib which is culture independent.
Due to this clientFirstDayOfWeek will always return as 6 which will be always Sunday.
Well work around to this issue could be to us the local registry entry through winAPI as below.
static int firstDayOfWeek()
{
#WinAPI
;
return str2int(WinAPI::getLocaleInfo(#LOCALE_USER_DEFAULT, #LOCALE_FIRSTDAYOFWEEK));
}

No comments:

Post a Comment