DefaultBindings for OffsetTime and OffsetDateTime handle negative offsets

[#4338] added support for converting PostgreSQL-formatted timestamps into OffsetDateTime's, but did not correct for negative offsets.
This commit is contained in:
Andrew Rueckert 2016-03-31 16:03:22 -07:00
parent b6b197c678
commit 464f007a5e

View File

@ -1486,7 +1486,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
return null;
// [#4338] PostgreSQL is more lenient regarding the offset format
if (string.lastIndexOf('+') == string.length() - 3)
if (string.lastIndexOf('+') == string.length() - 3 || string.lastIndexOf('-') == string.length() - 3)
string = string + ":00";
return OffsetTime.parse(string);
@ -1497,7 +1497,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
return null;
// [#4338] PostgreSQL is more lenient regarding the offset format
if (string.lastIndexOf('+') == string.length() - 3)
if (string.lastIndexOf('+') == string.length() - 3 || string.lastIndexOf('-') == string.length() - 3)
string = string + ":00";
// [#4338] SQL supports the alternative ISO 8601 date format, where a