I want to provide some styling to an app that is aware of work days and weekends, but I need it to be locale-aware. I'm aware of Calendar#getFirstDayOfWeek
, but this only returns the first day of the week, not the first day of the work week.
For example, with English(Canada) Calendar#getFirstDayOfWeek
returns Calendar.SUNDAY
, which is the first day of our week. Our work week starts on Calendar.MONDAY
, and our weekend days are Calendar.SATURDAY
and Calendar.SUNDAY
.
In English(United Kingdom), Calendar#getFirstDayOfWeek
returns Calendar.MONDAY
, and the first day of their work-week is Monday. Their weekend days are Calendar.SATURDAY
and Calendar.SUNDAY
.
Things get tricky for locales like Hebrew. The first day of their week is Calendar.SUNDAY
, but instead of the first day of their work week being Calendar.MONDAY
, it's Calendar.SUNDAY
. Their weekend days are Calendar.FRIDAY
and Calendar.SATURDAY
. Egypt is the same.
Iran only has one weekend day, Calendar.FRIDAY
.
Is there any method in Android to determine weekend days? We have some logic in place that covers most Western cases, but it's fragile, and a locale-aware platform API would be ideal, but I'm not aware of one.
Please note, I am not asking for a recommendation on some "best" library or anything of the sort. I'm asking if any such locale data exists on the Android platform at all, and if so, what API calls exist to access this data.