Ignore:
Timestamp:
Dec 4, 2009, 1:13:08 AM (15 years ago)
Author:
gav
Message:

Clicking on a searchCalendar day allows user to create a task with that day preset as targetStartDate.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/services/DateUtilService.groovy

    r210 r214  
    7676    }
    7777
     78    /**
     79    * Make a date object from supplied year, month, day values.
     80    * The Calendar.getInstance() or Calendar.instance factory returns a new calendar instance, usually
     81    * a Gregorian calendar but using Calendar we don't have to worry about those details.
     82    * The time fields are set to zero and cal.getTime() or cal.time returns a java.util.Date object.
     83    * @param year The year as a string or integer.
     84    * @param month The month as a string or integer.
     85    * @param day The day as a string or integer.
     86    * @returns A Date object having the given date and all time fields set to 0, so the very start of the given day.
     87    */
     88    public static Date makeDate(year, month, day) {
     89        Calendar cal = Calendar.instance
     90        cal.clear()
     91        // Stupid month is 0-based, grumble.
     92        cal.set(year.toInteger(), month.toInteger()-1, day.toInteger())
     93        cal.time
     94    }
     95
    7896}
Note: See TracChangeset for help on using the changeset viewer.