Skip to content

Commit 565265d

Browse files
committed
switch to version based logic
1 parent 4f774dc commit 565265d

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/parsing.jl

+14-6
Original file line numberDiff line numberDiff line change
@@ -295,15 +295,23 @@ end
295295

296296
_DEFAULT_TYPE_MAP[:time] = Time
297297
function pqparse(::Type{Time}, str::AbstractString)
298-
result = nothing
299-
try
298+
@static if v"1.6.6" <= VERSION < v"1.7.0" || VERSION >= "1.7.2"
300299
result = tryparse(Time, str)
301-
catch err
302-
if !(err isa InexactError)
303-
rethrow(err)
300+
if isnothing(result)
301+
# If there's an error we want to see it here
302+
result = parse(Time, _trunc_seconds(str))
303+
end
304+
return result
305+
else
306+
try
307+
return parse(Time, str)
308+
catch err
309+
if !(err isa InexactError)
310+
rethrow(err)
311+
end
312+
return parse(Time, _trunc_seconds(str))
304313
end
305314
end
306-
return isnothing(result) ? parse(Time, _trunc_seconds(str)) : result
307315
end
308316

309317
# InfExtendedTime support for Dates.TimeType

0 commit comments

Comments
 (0)