Bug/misleading documentation for <g:formatDate>

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Bug/misleading documentation for <g:formatDate>

alxndrsn
Hi, the documentation for the `formatDate` taglib method disagrees
with the implementation.

Documentation reads as follows:

     * @attr formatName Look up format from the default MessageSource
/ ResourceBundle (i18n/*.properties file) with this key. If format and
formatName are empty, format is looked up with 'default.date.format'
key. If the key is missing, 'yyyy-MM-dd HH:mm:ss z' formatting pattern
is used.

https://github.com/grails/grails-core/blob/master/grails-plugin-gsp/src/main/groovy/org/codehaus/groovy/grails/plugins/web/taglib/FormatTagLib.groovy#L133

The code reads:

                format = messageHelper('date.format', {
messageHelper('default.date.format', 'yyyy-MM-dd HH:mm:ss z', null,
locale) }, null, locale)

https://github.com/grails/grails-core/blob/master/grails-plugin-gsp/src/main/groovy/org/codehaus/groovy/grails/plugins/web/taglib/FormatTagLib.groovy#L189

Either the documentation should mention the `date.format` key, or the
code should not be making the outer call to `messageHelper`.  Which is
the correct behaviour?  I am happy to submit a pull request either
way.

Thanks,

Alex

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Bug/misleading documentation for <g:formatDate>

sergiomichels
I can't think of any problem on having the "date.format" key option. Maybe the doc should be updated?

--
Sérgio Michels


On Thu, Oct 10, 2013 at 7:02 AM, Alex Anderson <[hidden email]> wrote:
Hi, the documentation for the `formatDate` taglib method disagrees
with the implementation.

Documentation reads as follows:

     * @attr formatName Look up format from the default MessageSource
/ ResourceBundle (i18n/*.properties file) with this key. If format and
formatName are empty, format is looked up with 'default.date.format'
key. If the key is missing, 'yyyy-MM-dd HH:mm:ss z' formatting pattern
is used.

https://github.com/grails/grails-core/blob/master/grails-plugin-gsp/src/main/groovy/org/codehaus/groovy/grails/plugins/web/taglib/FormatTagLib.groovy#L133

The code reads:

                format = messageHelper('date.format', {
messageHelper('default.date.format', 'yyyy-MM-dd HH:mm:ss z', null,
locale) }, null, locale)

https://github.com/grails/grails-core/blob/master/grails-plugin-gsp/src/main/groovy/org/codehaus/groovy/grails/plugins/web/taglib/FormatTagLib.groovy#L189

Either the documentation should mention the `date.format` key, or the
code should not be making the outer call to `messageHelper`.  Which is
the correct behaviour?  I am happy to submit a pull request either
way.

Thanks,

Alex

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|

Re: Bug/misleading documentation for <g:formatDate>

alxndrsn
On 10 October 2013 17:31, Sergio Michels <[hidden email]> wrote:
> I can't think of any problem on having the "date.format" key option. Maybe
> the doc should be updated?

OK.  If it's just be changed in the source's javadoc, will that be
reflected in the HTML documentation?

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Bug/misleading documentation for <g:formatDate>

sergiomichels
Good question. I don't know if there's an integration to generate the gdoc from the javadoc. My guess is that you will need to update both - the class and the documentation. But maybe someone correct me if I'm wrong.

--
Sérgio Michels


On Fri, Oct 11, 2013 at 5:33 AM, Alex Anderson <[hidden email]> wrote:
On 10 October 2013 17:31, Sergio Michels <[hidden email]> wrote:
> I can't think of any problem on having the "date.format" key option. Maybe
> the doc should be updated?

OK.  If it's just be changed in the source's javadoc, will that be
reflected in the HTML documentation?

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email