On 10 juin, 17:05, Eric <[email protected]> wrote:
> On Jun 10, 6:31 am, Thomas Broyer <[email protected]> wrote:
>
> > On 8 juin, 16:29, Eric <[email protected]> wrote:
> > > Sadly, the best method is to use GWT's DateTimeFormat:
>
> > > private static final DateTimeFormat YEAR_FORMAT =
> > > DateTimeFormat.getFormat("yyyy");
> > > public static int year(final Date date) {
> > >   return Integer.parseInt(YEAR_FORMAT.format(date));
>
> > > }
>
> > Do you really think GWT won't use a Date#getYear() to output the
> > "yyyy" formatted string? How then parsing it back into an int would be
> > better than just calling getYear() and adding a @SuppressWarning on
> > your method?
>
> I've come to the conclusion that you're right.  I dislike suppressing
> warnings; I work on projects where people deprecate their own code
> but never refactor the old code away.  Suppressing warnings lets those
> people hide their malpractice from themselves.

...or you can use the new JsDate (in 2.1M1) ;-)
http://google-web-toolkit.googlecode.com/svn/javadoc/2.1/com/google/gwt/core/client/JsDate.html
(if you don't have to send it with GWT-RPC or use shared client/server
code)

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to