Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with firefox4: $wnd.Date.format is not a function #527

Open
GoogleCodeExporter opened this issue Jan 20, 2016 · 14 comments
Open

Problems with firefox4: $wnd.Date.format is not a function #527

GoogleCodeExporter opened this issue Jan 20, 2016 · 14 comments

Comments

@GoogleCodeExporter
Copy link

Hi, I've and old application with gwt-ext, and migrating is very impossible.
I've test it to firefox beta10, and I can't solved problems with dates.
I'm doing something wrong, I need your help.

Original issue reported on code.google.com by matienza...@gmail.com on 29 Jan 2011 at 9:03

@GoogleCodeExporter
Copy link
Author

Is there any news about this important problem?

Original comment by magnus12...@gmail.com on 23 Mar 2011 at 7:55

@GoogleCodeExporter
Copy link
Author

Possibly related:
- http://forums.smartclient.com/showthread.php?t=15947
- https://bugs.webkit.org/show_bug.cgi?id=17250

Original comment by matthewl...@gmail.com on 25 Mar 2011 at 4:52

@GoogleCodeExporter
Copy link
Author

Fix found! You'll need to add the following Javascript function to your HTML 
page:

Ext.newDate = function() {
    return new Date();
};

and then make the following modification to GWT-Ext's DateField class (I did so 
by overriding it so I wouldn't have to re-compile GWT-Ext; see attached):

    private native void setTime(JavaScriptObject df, double time)/*-{
        // doing the following instead of df.setValue(new $wnd.Date(time)); due to a Firefox 4/webkit bug
        // See http://code.google.com/p/gwt-ext/issues/detail?id=527 and https://bugs.webkit.org/show_bug.cgi?id=17250 for more info
        var dateJS = $wnd.Ext.newDate();
        dateJS.setTime(time);
        df.setValue(dateJS);
    }-*/;

Original comment by matthewl...@gmail.com on 25 Mar 2011 at 7:04

Attachments:

@GoogleCodeExporter
Copy link
Author

Bug reported to Mozilla: https://bugzilla.mozilla.org/show_bug.cgi?id=645130

Original comment by matthewl...@gmail.com on 25 Mar 2011 at 7:38

@GoogleCodeExporter
Copy link
Author

It seems it does not solve the .format function problem

Original comment by magnus12...@gmail.com on 28 Mar 2011 at 1:53

@GoogleCodeExporter
Copy link
Author

DateUtil.java in gwt-ext:

    public static native String format(Date date, String format) /*-{
        if(date == null) return "";
        var millis = @com.gwtext.client.util.DateUtil::getTime(Ljava/util/Date;)(date);

        return new $wnd.Date(millis).format(format).toString();

    }-*/;


The following line throws the same exception:
        return new $wnd.Date(millis).format(format).toString();


Original comment by magnus12...@gmail.com on 28 Mar 2011 at 1:57

@GoogleCodeExporter
Copy link
Author

Makes sense that this problem exists in multiple areas. You should be able to 
apply basically the same fix as I did to the DateField class; try changing

return new $wnd.Date(millis).format(format).toString();

to

var dateJS = $wnd.Ext.newDate();
dateJS.setTime(millis);
return dateJS.format(format).toString();

Original comment by matthewl...@gmail.com on 28 Mar 2011 at 3:28

@GoogleCodeExporter
Copy link
Author

Using the suggestions from this thread I've created a patched version of the 
gwt-ext library (in attachment).
You need also to modify you html page adding this code:

    <script type="text/javascript">
        Ext.newDate = function(time) {
            return new Date(time);
        };
    </script>

Original comment by defav...@gmail.com on 21 Apr 2011 at 2:57

Attachments:

@GoogleCodeExporter
Copy link
Author

Matthew, could you please compile your fixed gwtext with 1.5 complier?

Best regards,
Alex Andrushchak

Original comment by andrushc...@gmail.com on 23 May 2011 at 8:33

@GoogleCodeExporter
Copy link
Author

That's not me who made the JAR; that's defav...@gmail.com you should direct 
your question to.

Original comment by matthewl...@gmail.com on 23 May 2011 at 5:06

@GoogleCodeExporter
Copy link
Author

oops, sorry Mattew.

 defav...@gmail.com could you do it, please?




Original comment by andrushc...@gmail.com on 24 May 2011 at 7:34

@GoogleCodeExporter
Copy link
Author

Ok, disregard it. I compiled it myself.
Thanks for fixes.

Best regards,
Alex Andrushchak

Original comment by andrushc...@gmail.com on 27 May 2011 at 9:49

Attachments:

@GoogleCodeExporter
Copy link
Author

I am getting a validation error after applying this fix; e.g. a date in 
DateField is 27/02/2011, but the red underline and exclamation mark appear, 
claiming: "27/02/2011 is not a valid date - it must be in the format d/m/Y"

Did anyone encounter this problem? I'm in the middle of tracing the gwtext 
code, but this will probably take a while...

Original comment by yogi.wip...@gmail.com on 21 Jul 2011 at 1:24

@GoogleCodeExporter
Copy link
Author

Apparently the function Date.parseDate(...) conflicts with the ISC_Core.js in 
smartclient / smartgwt (which I have included to try out whether it is possible 
to use gwtext and smartgwt together. Would've made porting more incremental and 
thus easier.)

So this little incident made me conclude that it is impossible (or possible but 
very costly) to combine both libraries together.

Original comment by yogi.wip...@gmail.com on 21 Jul 2011 at 4:25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant