Discussion:
Suggestion: config.groovy support default.date.format=yyyy-MM-dd HH:mm:ss z or Support new Date(1239425656319)
Hubert Chang
2009-04-11 05:11:09 UTC
Permalink
Now grails is locale aware and will change the dateformat according to the
user's locale. It's good.

I suggest there is an option to support a default date format for the whole
application. Then I can change the locale setting with the client
javascript.

I noticed that grails-ui and the calendar plugins all do some hacks to the
dateformat.

1, Support default.date.format=yyyy-MM-dd HH:mm:ss z in config.groovy
If we have this option,grails-ui and calendar plugins will have easy
method to handle the datetime. For example, they can get the option from the
config, and set up a hidden input field to format the datetime string to the
hidden input value.

Or,
2, support new Date(1239425656319) like JSON parser. It will give more
convenience.
if grails can check the input value with a unix-timestamp and parse it
like JSON, new Date(1239425656319), when it found a value is not a correct
format date string, it will eval it as new Date(1239425656319)
automatically, it will give some convenience to the developers too.

Thanks.
--
View this message in context: http://www.nabble.com/Suggestion%3A-config.groovy-support-default.date.format%3Dyyyy-MM-dd-HH%3Amm%3Ass-z-or-Support-new-Date%281239425656319%29-tp22998094p22998094.html
Sent from the grails - user mailing list archive at Nabble.com.


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

http://xircles.codehaus.org/manage_email
Tom_G
2009-04-11 10:09:07 UTC
Permalink
I agree
Post by Hubert Chang
Now grails is locale aware and will change the dateformat according to the
user's locale. It's good.
I suggest there is an option to support a default date format for the
whole application. Then I can change the locale setting with the client
javascript.
I noticed that grails-ui and the calendar plugins all do some hacks to the
dateformat.
1, Support default.date.format=yyyy-MM-dd HH:mm:ss z in config.groovy
If we have this option,grails-ui and calendar plugins will have easy
method to handle the datetime. For example, they can get the option from
the config, and set up a hidden input field to format the datetime string
to the hidden input value.
Or,
2, support new Date(1239425656319) like JSON parser. It will give more
convenience.
if grails can check the input value with a unix-timestamp and parse
it like JSON, new Date(1239425656319), when it found a value is not a
correct format date string, it will eval it as new Date(1239425656319)
automatically, it will give some convenience to the developers too.
Thanks.
--
View this message in context: http://www.nabble.com/Suggestion%3A-config.groovy-support-default.date.format%3Dyyyy-MM-dd-HH%3Amm%3Ass-z-or-Support-new-Date%281239425656319%29-tp22998094p22999687.html
Sent from the grails - user mailing list archive at Nabble.com.


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

http://xircles.codehaus.org/manage_email
Marcel Overdijk
2009-04-11 18:12:16 UTC
Permalink
This is already possible in Grails 1.1 using default.date.format in message
bundles.
See GRAILS-3839 and GRAILS-3840.

However it's nowhere documented I believe.
I've raised GRAILS-4427 to document this feature.


Cheers,
Marcel
Post by Hubert Chang
Now grails is locale aware and will change the dateformat according to the
user's locale. It's good.
I suggest there is an option to support a default date format for the
whole application. Then I can change the locale setting with the client
javascript.
I noticed that grails-ui and the calendar plugins all do some hacks to the
dateformat.
1, Support default.date.format=yyyy-MM-dd HH:mm:ss z in config.groovy
If we have this option,grails-ui and calendar plugins will have easy
method to handle the datetime. For example, they can get the option from
the config, and set up a hidden input field to format the datetime string
to the hidden input value.
Or,
2, support new Date(1239425656319) like JSON parser. It will give more
convenience.
if grails can check the input value with a unix-timestamp and parse
it like JSON, new Date(1239425656319), when it found a value is not a
correct format date string, it will eval it as new Date(1239425656319)
automatically, it will give some convenience to the developers too.
Thanks.
--
View this message in context: http://www.nabble.com/Suggestion%3A-config.groovy-support-default.date.format%3Dyyyy-MM-dd-HH%3Amm%3Ass-z-or-Support-new-Date%281239425656319%29-tp22998094p23003912.html
Sent from the grails - user mailing list archive at Nabble.com.


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

http://xircles.codehaus.org/manage_email
Hubert Chang
2009-04-12 01:58:23 UTC
Permalink
I noticed that jira. It is for <g:formatDate> tag only. I mean an application
wide configuration.

I prefer to the second option.

When the server side get the date input data, it will check if it is an
unix-timestamp like '123456789000'. and if it is not an valid
unix-timestatmp, and also not an valid date format, it will throw an
exception.

Now for calendar plugin, grails-grails-ui plugin, <g:datepicker>, jquery-ui
plugin all do hacks to the date input. It is clear that the grails server
side doesn't provide a good option. If the server side can translate the
unix-timestamp, then the calendar plugin, grails-grails-ui plugin,
<g:datepicker>, jquery-ui plugin can translate the date with javascript
easily.
Post by Marcel Overdijk
This is already possible in Grails 1.1 using default.date.format in
message bundles.
See GRAILS-3839 and GRAILS-3840.
However it's nowhere documented I believe.
I've raised GRAILS-4427 to document this feature.
Cheers,
Marcel
Post by Hubert Chang
Now grails is locale aware and will change the dateformat according to
the user's locale. It's good.
I suggest there is an option to support a default date format for the
whole application. Then I can change the locale setting with the client
javascript.
I noticed that grails-ui and the calendar plugins all do some hacks to
the dateformat.
1, Support default.date.format=yyyy-MM-dd HH:mm:ss z in config.groovy
If we have this option,grails-ui and calendar plugins will have easy
method to handle the datetime. For example, they can get the option from
the config, and set up a hidden input field to format the datetime string
to the hidden input value.
Or,
2, support new Date(1239425656319) like JSON parser. It will give more
convenience.
if grails can check the input value with a unix-timestamp and parse
it like JSON, new Date(1239425656319), when it found a value is not a
correct format date string, it will eval it as new Date(1239425656319)
automatically, it will give some convenience to the developers too.
Thanks.
--
View this message in context: http://www.nabble.com/Suggestion%3A-config.groovy-support-default.date.format%3Dyyyy-MM-dd-HH%3Amm%3Ass-z-or-Support-new-Date%281239425656319%29-tp22998094p23007354.html
Sent from the grails - user mailing list archive at Nabble.com.


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

http://xircles.codehaus.org/manage_email
Loading...