Matteo
Matteo

Reputation: 14930

rich:calendar and default time

I am using two <rich:calendar>s to allow the user to enter a date range (from, to) using full days only:

<rich:calendar
    id                  = "timeTo"
    value               = "#{listModel.rangeStopErrorTime}"
    datePattern         = "yyyy-MM-dd"
    valueChangeListener = "#{listController.filterFieldChanged}"
    enableManualInput   = "true"
/>

If the user wants to specify a single day, both my from and to date will be the same (e.g., 2013-01-22T00:00:00). I would like to set the default time of the to field to the end of the day (e.g., 2013-01-22T23:59:59). I tried with the defaultTime attribute

<rich:calendar
    id                  = "timeTo"
    value               = "#{listModel.rangeStopErrorTime}"
    datePattern         = "yyyy-MM-dd"
    defaultTime         = "23:59:59"
    resetTimeOnDateSelect = "true"
    valueChangeListener = "#{listController.filterFieldChanged}"
    enableManualInput   = "true"
/>

but it works only if I change the datePattern to include the time (datePattern = "yyyy-MM-dd HH:mm:ss") and the time will be shown in the input field.

Is there a way to specify a default time without showing it to user?

Update:

Upvotes: 1

Views: 3854

Answers (1)

roel
roel

Reputation: 2003

As Luiggi Mendoza says, you should do it in the bean. On submit set the time.

Upvotes: 2

Related Questions