- Timestamp:
- May 31, 2010, 1:54:53 PM (15 years ago)
- Location:
- trunk/grails-app
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/TaskDetailedController.groovy
r552 r553 809 809 result.today.year = dateUtilService.getYearFromDate(result.today.date) 810 810 result.nextMonth = [:] 811 result.nextMonth.date = dateUtilService. getNextMonth(showDate)811 result.nextMonth.date = dateUtilService.plusMonth(showDate) 812 812 result.nextMonth.month = dateUtilService.getMonthFromDate(result.nextMonth.date) 813 813 result.nextMonth.year = dateUtilService.getYearFromDate(result.nextMonth.date) 814 814 result.previousMonth = [:] 815 result.previousMonth.date = dateUtilService. getPreviousMonth(showDate)815 result.previousMonth.date = dateUtilService.plusMonth(showDate, -1) 816 816 result.previousMonth.month = dateUtilService.getMonthFromDate(result.previousMonth.date) 817 817 result.previousMonth.year = dateUtilService.getYearFromDate(result.previousMonth.date) -
trunk/grails-app/services/DateUtilService.groovy
r552 r553 77 77 78 78 /** 79 * Get the date one month in the future. 80 * @param date The Date object to start with. 81 * @returns A Date object one month in the future. 79 * Get the date plus x weeks. 80 * @param date The Date object to start with, defaults to today. 81 * @param plusYears The number of weeks to add, defaults to 1. 82 * @returns A Date object adjusted by x weeks. 82 83 */ 83 public static Date getNextMonth(Date date) {84 public static Date plusWeek(Date date = new Date(), Integer plusWeeks = 1) { 84 85 use(TimeCategory) { 85 date + 1.months86 date + plusWeeks.weeks 86 87 } 87 88 } 88 89 89 90 /** 90 * Get the date one month ago. 91 * @param date The Date object to start with. 92 * @returns A Date object one month ago. 91 * Get the date plus x months. 92 * @param date The Date object to start with, defaults to today. 93 * @param plusYears The number of months to add, defaults to 1. 94 * @returns A Date object adjusted by x months. 93 95 */ 94 public static Date getPreviousMonth(Date date) {96 public static Date plusMonth(Date date = new Date(), Integer plusMonths = 1) { 95 97 use(TimeCategory) { 96 date - 1.months98 date + plusMonths.months 97 99 } 98 100 } … … 133 135 * @returns An integer representing the day of the month. 134 136 */ 135 public static Integer getDay FromDate(Date date) {137 public static Integer getDayOfMonthFromDate(Date date) { 136 138 Calendar cal = Calendar.instance 137 139 cal.setTime(date)
Note: See TracChangeset
for help on using the changeset viewer.