CRUD module: please add support for timestamp fields

Bug #530165 reported by Mark Schaake
24
This bug affects 4 people
Affects Status Importance Assigned to Milestone
play framework
New
Undecided
Unassigned
Declined for 1.0 by Nicolas Leroux
1.1
New
Undecided
Unassigned

Bug Description

I have the need to retrieve time values from the user. The Java Date class encapsulates both date and time values. Would be nice if CRUD could allow input of date AND time.

Some thoughts on how to implement:
1. Add annotation(s) to the play.models.Model class (or maybe it should go in validation?):
    @DateAndTimeField
    @TimeField

2. In the case of @DateAndTimeField, have CRUD generate two input tags - one for the date portion, the other for the time portion. Then, have a hidden field that contains the full timestamp value and that will be submitted to the actual Date field. For example:

public class MyClass extends Model {
    @DateAndTimeField
    public Date appointment;
}

CRUD-generated show/blank forms:

<!-- the date portion of the appointment -->
<input type="text" id="object_appointment_date" name="object_appointment_date" class="crud_date" value="${object.appointment.format('yyyy-MM-dd')}" />

<!-- the time portion of the appointment -->
<input type="text" id="object_appointment_time" name="object_appointment_time" class="crud_time" value="${object.appointment.format('hh:mm a')}" />

<!-- the hidden field that hold the fully qualified timestamp - will need to listen to changes to both fields -->
<input type="hidden" name="object.appointment" id="object_appointment" value="${object.appointment.format('yyyy-MM-dd HH:mm:ss')}" />

Thanks in advance! Love Play! Also, after some more experience, I'd like to get involved with contributing code to the Play! project.

Mark

Related branches

Revision history for this message
Matt Wilmott (mattwilmott) wrote :

Id like to add my support to the above proposal

Ran into this problem myself and the above looks promising

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.