Today I again encountered some strange things on different Domino machines. It’s Java again. The other specs are:
- my local dev box is 12.0.2FP2, running in a container using the HCL image
- the other machines are natively installed 12.0.2FP2, also Linux
- there are no language packs installed at all
The parts that are used:
- some Java in an NSF, defined as managed bean (but this doesn’t matter)
- Java is using ExtLibUtil and java.util.Calendar
- some XSP in an NSF
How to reproduce
Create an new NSF on your machine.
Create a new Java class org.openntf.XspHelper
.
Create an entry for the bean in faces-config.xml like this:
<managed-bean>
<managed-bean-name>xsp</managed-bean-name>
<managed-bean-class>org.openntf.XspHelper</managed-bean-class>
<managed-bean-scope>view</managed-bean-scope>
</managed-bean>
Create two methods in the class:
public String getBrowserLocale() {
return ExtLibUtil.getXspContext().getLocale().getDisplayLanguage().toLowerCase();
}
public String getTodayString() {
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd, HH:mm:ss");
StringBuilder sb = new StringBuilder();
Calendar cal = Calendar.getInstance();
sb.append(sf.format(cal.getTime()));
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
sb.append(" ----> ");
sb.append(sf.format(cal.getTime()));
sb.append(" - ");
cal.add(Calendar.DATE, 8);
sb.append(sf.format(cal.getTime()));
return sb.toString();
}
Create a new XPage env.xsp
and place this on it:
Browser language detected: 
<xp:text value="#{javascript:xsp.getBrowserLocale()}"></xp:text>
<br />
Date range based on today's date, starting on SUNDAY (should be the sunday BEFORE today's date): 
<xp:text value="#{javascript:xsp.getTodayString()}"></xp:text>
Observed behaviour
My dev box displays this (current date was Jan 8, 2025):
The other machines display this:
If you don’t see it: the locale string is localised itself which is strange. Even more strange is the fact that the date of the week’s SUNDAY is calculated in a different way, the other machine sets it to the next Sunday, my box to the one before the current date.
WTF?
So, if anyone knows what is going on here, how to configure it equally and if this maybe is a bug, please drop me a note!
BTW
Happy New Year!
Update
It seems that the 2 servers think they have to handle weeks differently, esp. the first day of the week. In this case it's SUNDAY, like in the US. My machine acts like it should be in my case, which is MONDAY as in almost every middle European country. The solution is to staticly define the start of the week accordingly:
cal.setFirstDayOfWeek(Calendar.MONDAY);