Skip to content

Commit 36291bf

Browse files
committed
Add timezone offset to string representation of TimestampValue
1 parent 4c15bc1 commit 36291bf

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ principal with a delegation token for authorization and authentication:
2525
### Fixed
2626
- Ensure that TableLimits is always null in TableResult on-premise.
2727
- Fixed a problem where SignatureProvider.getAuthorizationString may fail due to an IllegalStateException with error "Timer already cancelled".
28-
28+
- Add timezone offset to the string representation of a TimestampValue to properly conform to ISO 8601 format.
2929

3030
### Changed
3131
- DefaultRetryHandler now uses incremental backoff mechanism (instead of fixed 1-second delay) and may be extended.

driver/src/main/java/oracle/nosql/driver/util/TimestampUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ private static String formatString(Timestamp timestamp,
188188
return zdt.format(getDateTimeFormatter(fmt,
189189
withZoneUTC,
190190
optionalFracSecond,
191-
false));
191+
true));
192192
} catch (IllegalArgumentException iae) {
193193
throw new IllegalArgumentException("Failed to format the " +
194194
"timestamp with pattern '" + fmt + "': " + iae.getMessage(),

driver/src/test/java/oracle/nosql/driver/ValueTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ public void testTimestamp() {
452452
}
453453

454454
/* Test toJson(JsonOptions) */
455-
text = "2017-07-15T15:18:59.123456789";
455+
text = "2017-07-15T15:18:59.123456789Z";
456456
tsv = new TimestampValue(text);
457457

458458
JsonOptions options = new JsonOptions().setTimestampAsString(true);
@@ -853,7 +853,7 @@ public void testSize() {
853853
assertSize(val, 12);
854854

855855
val = new TimestampValue(tsText);
856-
assertSize(val, 31);
856+
assertSize(val, 32);
857857

858858
val = BooleanValue.trueInstance();
859859
assertSize(val, 2);

0 commit comments

Comments
 (0)