I am having an issue with the dateutils, with regards to the week calculations.
Which locale is this module using? Is this only dependent on the server locale or also on the client pc locale?
To me, it looks like it solely depents on the server locale.
I have a test server that is giving me unexpected results for the following code:
var dt = new scopes.svyDateUtils.DateTime();
plugins.webnotificationsToastr.info('Date: '+dt.toStartOfDay().toFirstDayOfWeek().addWeeks(-1).date.toISOString()+
' Week: '+scopes.svyDateUtils.getWeekOfYear(dt.date));
When I run this locally on my laptop in developer I get:
Date: 2021-06-27T22:00:00.000Z Week: 26
But on this test server I get:
Date: 2021-06-19T22:00:00.000Z Week: 25
The region settings of this server look the same as on my laptop:
Country or Region: Netherlands
Regional format: Dutch
Timezone: (UTC+01:00) Amsterdam
These time functions will also be used in API calls so what I would like to do, is to force them all to use the ISO standard which is included in ISO 8601. This system dictates that each week begins on a Monday and is associated with the year that contains that week's Thursday.
Hoewever I don’t think this is supported by svyDateUtils. So I am leaning to modify all java.util.Calendar.getInstance() to java.util.Calendar.getInstance(java.util.Locale.UK)
Or do you have a better suggestion for me?