Changeset 1428
- Timestamp:
- 23/12/09 10:50:01 (3 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
tupper/trunk/tupper-site/src/main/java/org/kauriproject/tupper/resource/CalendarUtil.java
r1427 r1428 21 21 public static int getNumberOfWeeksInYear(int year) { 22 22 Calendar calendar = getCalendar(); 23 calendar.set( Calendar.DAY_OF_YEAR, 1);24 calendar.set( Calendar.YEAR, year);25 return calendar.getActualMaximum( Calendar.WEEK_OF_YEAR);23 calendar.set(DAY_OF_YEAR, 1); 24 calendar.set(YEAR, year); 25 return calendar.getActualMaximum(WEEK_OF_YEAR); 26 26 } 27 27 28 28 public static Calendar getCalendar(int week, int year) { 29 29 Calendar calendar = getCalendar(); 30 calendar.set( Calendar.YEAR, year);31 calendar.set( Calendar.WEEK_OF_YEAR, week);30 calendar.set(YEAR, year); 31 calendar.set(WEEK_OF_YEAR, week); 32 32 33 33 // For the first and last week of the year, we have to be careful … … 38 38 // year that corresponds to the week number. 39 39 if (week == 1) { 40 calendar.set( Calendar.DAY_OF_YEAR, 1);40 calendar.set(DAY_OF_WEEK, SATURDAY); 41 41 } else { 42 42 // we don't check explictly for the last week of the year, 43 43 // but this covers it 44 calendar.set( Calendar.DAY_OF_WEEK, calendar.getFirstDayOfWeek());44 calendar.set(DAY_OF_WEEK, calendar.getFirstDayOfWeek()); 45 45 } 46 46 return calendar; … … 79 79 // Go via calendar to do a lenient interpretation of the values 80 80 81 Calendar startCal = CalendarUtil.getCalendar(startWeek, startYear);81 Calendar startCal = getCalendar(startWeek, startYear); 82 82 startWeek = startCal.get(WEEK_OF_YEAR); 83 83 startYear = startCal.get(YEAR); 84 84 85 Calendar endCal = CalendarUtil.getCalendar(endWeek, endYear);85 Calendar endCal = getCalendar(endWeek, endYear); 86 86 endWeek = endCal.get(WEEK_OF_YEAR); 87 87 endYear = endCal.get(YEAR);
