DatePicker Issue in dynamic crm v9.1

We have already patched the CRM Date Picker in Microsoft Fabric UI as it was used in Microsoft Dynamics 365 prior to version 9.1. Now in version 9.1, it seems that they have upgraded the Fabric Ui, and we need to patch this new version. First of all, the Fabric is now called the ‘fluentui’. They’ve decided to rename the library. In the previous version we pacthed some ‘_getWeeks’ function which was responsible to return an array of days included in a month. The calendar view used this information to draw those days.

We figured out that the same responsibility is now moved to some getDayGrid function. Note that the whole library is rewritten in typescript now. Its somehow difficult to find the sources, because of complex structure of the github project. Its under ‘./packages/date-time-utils.src/dateGrid/getDayGrids.ts’ in the git cloned fluentui repo.

This function is used for instance in ‘CalendarDayGrid.base.tsx’ as shown below.

The compiled (js) version as exported in the distribution version (@fluentui/date-time-utils installed with nmp install @fluentui/date-time-utils):

The function will appear in a babled/uglified version as exposed in the dynamic web resource ‘{637647911620000914}/webresources/cc_shared/office_ui_date_time/7.14.2/libs/office_ui_date_time.js’

Note that the function source has been totally copied to its usage place much like a C++ inline function:

Besides fixing the drawing/visual aspect of CRM Date Picker, we should also worry about paring and formatting of date values. It turns out that MS Dynamics handles that for us, by overriding the defaults down to the ‘DateTimeFormatInfo’, which is apparently part of ‘Microsoft.Ajax.js’ client library. The DateTimeFormatInfo has a tiny ‘calendar’ object with ‘toGregorian’ and ‘fromGregorian’ methods. We have already fixed it in our previous versions and this would the job here wit ‘app.js’ (previously legacy.js) fixup.

There is also the issue of formatting the header of the date picker for instance when formatting the ‘Year’ and ‘Month’. It turns out that formatting is provided by the ‘formatMonthYear’ function:

This is actually exposed in ‘DateFormatting.defaults.ts’

Which is eventually seen in the web resource(/{637647911620000914}/webresources/cc_shared/office_ui_date_time/7.14.2/libs/office_ui_date_time.js) as:

And we should come up with a fixup in this case.

دیدگاه‌ خود را بنویسید

نشانی ایمیل شما منتشر نخواهد شد. بخش‌های موردنیاز علامت‌گذاری شده‌اند *

سبد خرید
به بالای صفحه بردن