On 9/23/07, Gerolf Seitz <[EMAIL PROTECTED]> wrote:
> i was wondering if we could provide the facilities to set a
> DateFormat/-Pattern (to format the date in feedback messages) for
> DateValidators?
> the default format in a feedback message via toString() (like "Sun Sep 23
> 23:59:55 CEST 2007") seems rather strange,
> when the user needed to enter a date in a different format (which he
> probably will).
>
> i was thinking of the following:
>
> add "DateValidator withDateFormat(DateFormat format)" and "DateValidator
> withDatePattern(String pattern)" to DateValidator.
> every DateValidator (Range, Minimum, Maximum) should add the variable values
> like this:
>
> protected Map variablesMap(IValidatable validatable)
>         {
>             final Map map = super.variablesMap(validatable);
>             map.put("maximum", formatDate(maximum)); // use formatDate(Date)
>             return map;
>         }
>
> the formatDate method either uses the provided dateformat to format the date
> or otherwise (in case no dateformat/patter was provided) just returns the
> result of the toString() method.
>
> so, wdyt?

Not sure, though I have a hunch Igor has an idea how this should be
done without a new API.

Eelco

Reply via email to