Yesterday I have received the answer to a question here: WEEK_OF_YEAR inconsistent on different machines
(basically, learned how WEEK_OF_YEAR gets computed based on firstDayOfWeek and minimalDaysInFirstWeek)
But now I have a follow-up question - what other settings could be affecting a Calendar's ability to use the default locale? Because here's the behaviour that I am observing (having a correct en_US default locale):
Calendar c = Calendar.getInstance(); // should use the default locale, per docs
System.out.println(c.getFirstDayOfWeek());
System.out.println(c.getMinimalDaysInFirstWeek());
c = Calendar.getInstance(Locale.getDefault()); // provide the default explicitly
System.out.println(c.getFirstDayOfWeek());
System.out.println(c.getMinimalDaysInFirstWeek());
The output of running this is:
- 2
- 4
- 1
- 1
It looks even more absurd (setDefault to the results of getDefault...?!) if I run this in Clojure (a JVM language, so the behaviour is exactly the same):
user=> (.getFirstDayOfWeek (java.util.Calendar/getInstance))
2
user=> (Locale/setDefault (Locale/getDefault))
nil
user=> (.getFirstDayOfWeek (java.util.Calendar/getInstance))
1
The examples above are run without any JVM arguments whatsoever - so, my question is, where could the setting of 2 and 4 for the firstDayOfWeek and minimalDaysInWeek be coming from? And, perhaps most importantly - how do I fix them permanently?
Thanks!