question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Please support java.util.Calendar by default

See original GitHub issue
What steps will reproduce the problem?
1. Create a Class Customer with 
Customer {
 String name;
 Calendar timestamp;
}
2.  Try Serializing this class and you will get an exception for Calendar

3.
            Customer c = new Customer();
        c.setName("jjj sdss");
        c.setRegTime(Calendar.getInstance());
                Gson gson = new Gson();
        String json = gson.toJson(c);

What is the expected output? What do you see instead?
Calendar seems to be not supported


What version of the product are you using? On what operating system?


Please provide any additional information below.
java.lang.RuntimeException: Unable to invoke no-args constructor for class
java.util.Calendar. Register an InstanceCreator with Gson for this type may
fix this problem.



Can java.util.Calendar be supported by default ??? 

Original issue reported on code.google.com by njun...@gmail.com on 5 Mar 2009 at 8:01

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:5

github_iconTop GitHub Comments

11reactions
tudorpavelcommented, Feb 29, 2016

It would be nice to support java.util.Calendar model attributes for converting from an ISO 8601 format like 2016-02-29T15:00:00+02:00, in order to store both the UTC datetime and the time zone data.

0reactions
brandoFScommented, Jan 28, 2016

@GoogleCodeExporter how would I parse a string in format “yyyy-MM-dd” into Calendar object using GSON ??

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is the default timezone for java.util.Calendar.?
Gets a calendar using the default time zone and locale. The Calendar returned is based on the current time in the default time...
Read more >
java.util.Calendar - Javatpoint
No Method Description 7. protected void complete() It fills any unset fields in the calendar fields. 19. public int getFirstDayOfWeek() Returns the first day of...
Read more >
Calendar (Java Platform SE 7 ) - Oracle Help Center
The default value of each field may vary by concrete calendar systems. For example, in GregorianCalendar , the default of a field is...
Read more >
java.util Class GregorianCalendar
GregorianCalendar is a concrete subclass of Calendar and provides the standard calendar used by most of the world. The standard (Gregorian) calendar has...
Read more >
getFirstDayOfWeek() in java.util.Calendar returns 1 for non ...
Component: core-libs | Sub-Component: java.util:i18n. ... we should develop applications in diferent languages that are not supported by default in the JDK.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found