Enable Week Number in the little Calendar too?

Hello!
I applied the option to display Week Number in the Calendar Module, but I wanted to know if it is possible to apply this option in the little Calendar that appears when you create new rows in modules.
Example (in the opportunities):
example calendar

hi

I made this PR that adds week numbers as an option from the UI:

But it was a long time ago and I don’t fully remember what it does… :grinning_face_with_smiling_eyes:

How did you add week numbers? By changing code?

@martaz
Look at the file include/javascript/calendar.js and add one or two lines

...
calendar = new YAHOO.widget.Calendar(showButtonElement.id + '_div', {
    iframe:false,
    hide_blank_weeks:true,
/* add line */
    show_week_header:true,
    show_week_footer:true,
/**/
    navigator:navConfig
});
...

It isn’t support upgrade.

1 Like

I changed WeekNumbers:True

I tried to add those lines in calendar.js but the calendar is not changing, even with Repair Js Files

@martaz

Have you cleared your browser cache?

Yes, I cleared it too.
Actually I’m not sure if I paste the code correctly:

@martaz

It’s not right. You should find line where is created new object YAHOO.widget.Calendar and add one or two line as parameters of the object. I wrote the lines block so you can find the right place. You should add the lines only:

show_week_header:true,
show_week_footer:true,

Okay, thanks for the explanation. Now I’m making the changes correctly, but they’re not showing anyway. Maybe I’m not “repairing” correctly, (changes are not updating correctly). Could you please tell me what type of Repair should I do?

@martaz
No. You shouldn’t do Repair. This file load directly. You should clear cache only and can check the file in your browser.

Okay, thanks for the explanation! Now the editings are showing, but there’s still a problem with the calculation:
wrong calculation
The week 1 should start from January 4th, not December.

There are options

https://fullcalendar.io/docs/weekNumberCalculation

although I am not sure about how they should be used to get what you want…

I found this documentation for the calendar:
https://yui.github.io/yui2/docs/yui_2.5.0/docs/YAHOO.widget.Calendar.html
I had to set START_WEEKDAY to 1 (Monday), but I also need to change the week number calculation, from default to ISO, but I’m not finding any variable that is implicated in this calculation

I think we use FullCalendar, not that YUI (unless for some reason they are the same), and the correct Docs site is the one I linked in my post above. Have you tried that setting?

In the javascript code for the little calendar to create the Calendar object you used the class: calendar=new YAHOO.widget.Calendar (…)
That’s why I searched for it and tried to find the variables to change, that are:
first day of the week (monday), already changed
calculation (ISO), don’t know how to change it in the code
I actually don’t know exactly how the week numbers are calculated in that code, but of course it is set to default (Local), but I wanted ISO

In the same place where you specified option show_week_header etc, try adding

weekNumberCalculation : “ISO”

I already tried, but it didn’t work. probably it’s another variable