Skip to content

Commit d5ad4c4

Browse files
committed
Fix date time format for Android client
According to Android's docs (https://developer.android.com/reference/java/text/SimpleDateFormat.html) the `SimpleDateFormat` class in Android does not accept `XXX` as the timezone, it uses `Z` instead. Also updated the date time format of Android and Java clients to include milliseconds.
1 parent 6ac497d commit d5ad4c4

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

modules/swagger-codegen/src/main/resources/Java/apiInvoker.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class ApiInvoker {
4141
* ISO 8601 date time format.
4242
* @see https://en.wikipedia.org/wiki/ISO_8601
4343
*/
44-
public static final SimpleDateFormat DATE_TIME_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX");
44+
public static final SimpleDateFormat DATE_TIME_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
4545
4646
/**
4747
* ISO 8601 date format.

modules/swagger-codegen/src/main/resources/android-java/apiInvoker.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public class ApiInvoker {
7070
* ISO 8601 date time format.
7171
* @see https://en.wikipedia.org/wiki/ISO_8601
7272
*/
73-
public static final SimpleDateFormat DATE_TIME_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX");
73+
public static final SimpleDateFormat DATE_TIME_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
7474
7575
/**
7676
* ISO 8601 date format.

samples/client/petstore/android-java/src/main/java/io/swagger/client/ApiInvoker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public class ApiInvoker {
7070
* ISO 8601 date time format.
7171
* @see https://en.wikipedia.org/wiki/ISO_8601
7272
*/
73-
public static final SimpleDateFormat DATE_TIME_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX");
73+
public static final SimpleDateFormat DATE_TIME_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
7474

7575
/**
7676
* ISO 8601 date format.

samples/client/petstore/java/src/main/java/io/swagger/client/ApiInvoker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class ApiInvoker {
4141
* ISO 8601 date time format.
4242
* @see https://en.wikipedia.org/wiki/ISO_8601
4343
*/
44-
public static final SimpleDateFormat DATE_TIME_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX");
44+
public static final SimpleDateFormat DATE_TIME_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
4545

4646
/**
4747
* ISO 8601 date format.

0 commit comments

Comments
 (0)