# Grails Datepicker Magic

Been working much more on the frontend side of web development lately, but found a nice trick in Grails that seemed good to throw out there. Maybe this is documented somewhere and I just always missed it. I knew the datePicker tag in gsp’s worked nicely for binding to domainClass objects through dataBinding, but didn’t know it could also be used as a super convenient way to get a Date object in a controller. This is in Grails 2.3 BTW. Example: My use case was a simple report that needed to be run for a given month. in the gsp:

Sweet. That is a really quick way to generate the HTML I want. Now, here is the really slick part I didn’t know about. In the controller I can access the params.report object and it will be a Date!