Skip to content

Commit 6b4d710

Browse files
author
Jonathan Wenger
committed
Avalara-SDK-Java issue #6 - Fix issue where API wants a LocalDateTime format while preserving the use of OffsetDateTime
1 parent 3e5f55e commit 6b4d710

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/main/java/Avalara/SDK/ApiClient.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,13 @@ public String parameterToString(Object param) {
621621
if (param instanceof Number || param instanceof Boolean) {
622622
return String.valueOf(param);
623623
}
624-
if (param instanceof Date || param instanceof OffsetDateTime || param instanceof LocalDate) {
624+
if (param instanceof OffsetDateTime odt) {
625+
// Convert to LocalDateTime and format as ISO_LOCAL_DATE_TIME
626+
return odt
627+
.toLocalDateTime()
628+
.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME);
629+
}
630+
if (param instanceof Date || param instanceof LocalDate) {
625631
String jsonStr = json.serialize(param);
626632
// e.g. "\"2025-05-06T12:00:00Z\"" → "2025-05-06T12:00:00Z"
627633
return jsonStr.substring(1, jsonStr.length() - 1);

0 commit comments

Comments
 (0)