Fix timezone detection when time has fractional component (#544)

This commit is contained in:
Thomas Pelletier
2021-05-21 09:37:43 -04:00
committed by GitHub
parent 238a6fef7d
commit c2d1fd86e5
4 changed files with 46 additions and 3 deletions
+8
View File
@@ -172,6 +172,14 @@ func parseLocalTime(b []byte) (LocalTime, []byte, error) {
digits := 0
for i, c := range b[minLengthWithFrac:] {
if !isDigit(c) {
if i == 0 {
return t, nil, newDecodeError(b[i:i+1], "need at least one digit after fraction point")
}
break
}
const maxFracPrecision = 9
if i >= maxFracPrecision {
return t, nil, newDecodeError(b[i:i+1], "maximum precision for date time is nanosecond")