/**
* {@icu} Returns whether the given day of the week is a weekday, a
- * weekend day, or a day that transitions from one to the other,
- * in this calendar system. If a transition occurs at midnight,
- * then the days before and after the transition will have the
+ * weekend day, or a day that transitions from one to the other, for the
+ * locale and calendar system associated with this Calendar (the locale's
+ * region is often the most determinant factor). If a transition occurs at
+ * midnight, then the days before and after the transition will have the
* type WEEKDAY or WEEKEND. If a transition occurs at a time
* other than midnight, then the day of the transition will have
* the type WEEKEND_ONSET or WEEKEND_CEASE. In this case, the
if (dayOfWeek < SUNDAY || dayOfWeek > SATURDAY) {
throw new IllegalArgumentException("Invalid day of week");
}
+ if (weekendOnset == weekendCease) {
+ if (dayOfWeek != weekendOnset)
+ return WEEKDAY;
+ return (weekendOnsetMillis == 0) ? WEEKEND : WEEKEND_ONSET;
+ }
if (weekendOnset < weekendCease) {
if (dayOfWeek < weekendOnset || dayOfWeek > weekendCease) {
return WEEKDAY;
return (weekendOnsetMillis == 0) ? WEEKEND : WEEKEND_ONSET;
}
if (dayOfWeek == weekendCease) {
- return (weekendCeaseMillis == 0) ? WEEKDAY : WEEKEND_CEASE;
+ return (weekendCeaseMillis >= 86400000) ? WEEKEND : WEEKEND_CEASE;
}
return WEEKEND;
}
/*
*******************************************************************************
- * Copyright (C) 2000-2012, International Business Machines Corporation and
+ * Copyright (C) 2000-2013, International Business Machines Corporation and
* others. All Rights Reserved.
*******************************************************************************
*/
Calendar.MONDAY, Calendar.WEEKDAY,
Calendar.FRIDAY, Calendar.WEEKDAY,
Calendar.SATURDAY, Calendar.WEEKEND,
- Calendar.SUNDAY, Calendar.WEEKEND_CEASE,
+ Calendar.SUNDAY, Calendar.WEEKEND,
},
new Locale("ar", "YE"), new int[] { // Thursday:Friday
Calendar.WEDNESDAY,Calendar.WEEKDAY,
Calendar.SATURDAY, Calendar.WEEKDAY,
Calendar.THURSDAY, Calendar.WEEKEND,
- Calendar.FRIDAY, Calendar.WEEKEND_CEASE,
+ Calendar.FRIDAY, Calendar.WEEKEND,
+ },
+ new Locale("hi", "IN"), new int[] { // Sunday only
+ Calendar.MONDAY, Calendar.WEEKDAY,
+ Calendar.FRIDAY, Calendar.WEEKDAY,
+ Calendar.SATURDAY, Calendar.WEEKDAY,
+ Calendar.SUNDAY, Calendar.WEEKEND,
},
};