Alex Rivera | Logout

gwt: No source code is available for type java.util.Calendar

Asked 2010-11-13T03:37:24.657
13

I tried to use java.util.Calendar in my GWT application as following:

Calendar cal = Calendar.getInstance();

then i got this error:

No source code is available for type java.util.Calendar; did you forget to inherit a required module?

anyone know what's wrong with it?

Edit
Report

3 Answers

7

The Calendar class depends on a lot of Java classes that GWT cannot possibly convert to Javascript. If it fits your needs, you could simply do new Date() on the client side. See here for more details.

You could also try the gwt-calendar project.

answered 2010-11-13T04:54:27.103
3

java.util.Date will still work, and you can use com.google.gwt.i18n.client.DateTimeFormat to do any date formatting you need to do.

Check that link for full example code.

answered 2010-11-13T05:37:01.907
1
answered 2012-04-19T12:51:31.540

Your Answer