Week numbers in date picker and calendar

Hi,

Does SuteCRM have an option to show week numbers in a calendars (calendar itself, date picker)? I could not find a setting to enable this.

No, it doesn’t.

This depends on the underlying Calendar impementation which is FullCalendar, which does have an option for this (although I have no idea what exactly it does).

As you can in our code see this option is always hard-coded to false:
https://github.com/salesagility/SuiteCRM/search?p=1&q=weekNumbers&unscoped_q=weekNumbers

A quick non-upgrade-safe fix would be to uncomment this line here and then run Admin / Repairs / Rebuild JS.

You can also ask this kind user who recently had a very similar question to yours, to make that option configurable at the same time that he works on his own change and contributes it to core:

Hi,
Thanks for the tip regarding the jssource/src_files/modules/Calendar/Cal.js. Changing this added weeknumbers to the calendar module, but not to the smal calendar in the datepicker when scheduling calls etc. I think it is this file: include/SugarFields/Fields/Datetime/SugarFieldDatetime.php

What’s though strange is that the weeknumbers shown are wrong in jssource/src_files/modules/Calendar/Cal.js . Eg. the current week today is shown as W48, even if it should be W5. So Week 1 starts according to this calendar on Monday 2nd of March 2020…

That is quite weird, yes. Only thing that I can think of is that this is a FullCalendar bug. Maybe you can find some reference to it if you search their project. We are not using their newest version (nowhere near that, I fear) :frowning:

Ahaa… Got it. They had a bug in 2015 which did show the weeknumberw wrong

Here is also an attached screenshot of the problem

In their demo though the weeknumbers work correctly:
https://fullcalendar.io/docs/weekNumbers-demo

Is the fullcalendar also used in the datepicker that is used in the other modules eg when adding meetings?

Figured this out… We need to add “weekNumberCalculation: ‘ISO’,” to the config-section of the calendar where “weekNumbers: true”, then the week numbers show correct! :slight_smile:

So part of my case is now solved. Next would be to get the weeknumber to the datepicker…

I can’t look into this right now, but if you check the rendered HTML on the datepicker you can probably figure out if it0s also coming from FullCalendar or not, or find it in our source code so we can check how it’s generated…

I made a PR to allow adjusting week numbers from the Settings UI

Wow, great! Thanks! :slight_smile:

Note that these settings’ defaults can also be overridden system-wide in config_override.php. Users can still adjust their own preferences after that. Examples:

$sugar_config['calendar']['event_limit'] = 3;
$sugar_config['calendar']['show_week_numbers'] = 1;