week numbers showing wrong, because of american time

AbooK
Tera Contributor

Hey,

 

Im struggeling with an issue. I have this code in a script include:

 

getWeek: function(dt) {
var tdt = new Date(dt.valueOf());
var dayn = (dt.getDay() + 6) % 7;
tdt.setDate(tdt.getDate() - dayn + 3);
var firstThursday = tdt.valueOf();
tdt.setMonth(0, 1);
if (tdt.getDay() !== 4) {
tdt.setMonth(0, 1 + ((4 - tdt.getDay()) + 7) % 7);
}
return 1 + Math.ceil((firstThursday - tdt) / 604800000);

 

 

However it seems to be ahead 1 week of our Norwegian weeks. I guess American weeks starts on Sunday, while our week starts on Monday. Is there any way to make changes to that code so its showing the correct weeks?

Now all the incidents we register on for example week 11 gets shown on week 12.

 

Any help is appreciated.

2 REPLIES 2

Tony Chatfield1
Kilo Patron

Hi, if your instance is not shared across multiple TZ's/countries with different requirements,
you can set the day that your week starts.
Setting Monday as the first day of the week in the calendar - Support and Troubleshooting (serviceno...

Hey, 

Thanks for the reply, however we have already set our glide.ui.date_picker.first_day_of_week to the value of 2 in our instance.