Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Time format/picker in Grails?

I have a domain class called schedule. It has the following fields:

String timeStart
String timeEnd
Date date
String timeZone

I want to know, what datatype should be used for time. I think, Date should be enough but I want a to separate it from the time, so how should I go about that. I just want to extract this part: MM/DD/YY...

In the views, is there some kind of plugin or tag that can be used for the time alone? Like, a couple of combo boxes that can allow the user to select an hour, minutes, and probably AM or PM? I can do it manually, but a plugin would be nice... :)

The current plugin I'm looking into right now is: http://www.grails.org/plugin/calendar

like image 692
황현정 Avatar asked Mar 10 '26 12:03

황현정


1 Answers

If you can choose I would go with Joda Time via the joda time plugin. Joda time is a MUCH BETTER replacement for java.date and calendar.

Then your domain classes for a schedular would become something like this:

class Schedule {
    static hasMany = [appointments:Appointment]
}

class Appointment {
    DateTime start
    DateTime end
    other properties e.g. name, description...
}

The timezone and date data is all in the DateTime object.

like image 91
moritz Avatar answered Mar 13 '26 16:03

moritz