week numbers showing wrong, because of american time
This content was last updated in 2024. It may still be useful, but could contain outdated information. Please confirm its accuracy before relying on it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2024 04:18 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2024 12:44 PM
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...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2024 03:40 AM
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.