-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
GsonBuilder.setDateFormat(int) is ignored #1529
Labels
Comments
9 tasks
Actually maybe it would make sense to do the following:
|
9 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As described in https://stackoverflow.com/questions/6873020/gson-date-format, calling
Gson.setDateFormat(int)
has no effect, the created Gson object will not use the date format.It appears the reason for this is that the method only sets
dateStyle
, buttimeStyle
remains unchanged, i.e. if it has not been changed before, then it is stillDateFormat.DEFAULT
.gson/gson/src/main/java/com/google/gson/GsonBuilder.java
Lines 451 to 454 in 63ee47c
However
addTypeAdaptersForDate
only uses the styles iftimeStyle != DateFormat.DEFAULT
.gson/gson/src/main/java/com/google/gson/GsonBuilder.java
Line 615 in 63ee47c
The text was updated successfully, but these errors were encountered: