On Tuesday, May 17, 2011 7:42:07 PM UTC+2, ghost23 wrote:
>
> Unfortunately it doesn't work, at runtime i get the error, that this:
>
> return [email protected]::dateObject.format(stringFormat);
>
> is not allowed. At the dateObject position it says, "*missing ; before 
> statement*". But i don't quite understand that.
> How would i have to write it instead?
>

I'd try either:
   var dateObject = [email protected]::dateObject;
   return dateObject.format(stringFormat);
or
   return ([email protected]:dateObject).format(stringFormat);

But well, actually, I'd rather split the method:
   public String format(String str) {
       return format(this.dateObject, str);
   }
   private static native String format(JavaScriptObject dateObject, String 
stringFormat) /*-{
      return dateObject.format(stringFormat);
   }-*/;

As a side note, you can use JsDate.create() instead of your 
createNewJSDateObject method.

...and finally, I wonder how that'd work in the end, given that there's no 
format() method on a JS Date object. If you're using a third-party library 
that modifies the Date.prototype, you'll have to use "new $wnd.Date()" to 
use the modified prototype (but well, I'd rather change third-party lib in 
this case, as augmenting prototypes is a really bad JS pattern).

-- 
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