Michał Sobkiewicz created FREEMARKER-31:
-------------------------------------------

             Summary: Default date type as setting
                 Key: FREEMARKER-31
                 URL: https://issues.apache.org/jira/browse/FREEMARKER-31
             Project: Apache Freemarker
          Issue Type: Improvement
          Components: engine
            Reporter: Michał Sobkiewicz


To set default date type, one have to use 
{{freemarker.ext.beans.BeansWrapperConfiguration#setDefaultDateType(int)}} or 
{{freemarker.ext.beans.BeansWrapper#setDefaultDateType(int)}}. It would be 
convenient to set {{defaultDateType}} (among others) by using properties.

{{freemarker.core.Configurable#setSetting(String,String)}} recognises date, 
time and number formats. It even lets you choose object wrapper! At the same 
time you can't specify how to deal with not-so-exotic {{java.util.Date}}.

I'd like to set default date type just as I can set exception handling. I know 
that {{defaultDateType}} attribute would have to be moved to 
{{freemarker.template.Configuration}}, but I'm convinced that this is the right 
thing to do.

If it makes sense to talk about "default date type" (which seems to be true as 
{{defaultDateType}} property already exists), it may be also valid to expect a 
little more accessible way to set this up. With no customized bean wrapper, 
without adding a bit redundant "?date" after each... well.. date, you end up 
with {{freemarker.core.UnknownDateTypeFormattingUnsupportedException}}.

Sample settings below:

{quote}
locale=en_US
dateFormat=yyyy-MM-dd
numberFormat=0.00
logTemplateExceptions=false
templateExceptionHandler=rethrow
defaultDateType=date
{quote}

I truly believe that the last one should be supported.




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to