Skip to content

Commit 4c8a12e

Browse files
committed
clean up tryparse logic
1 parent 565265d commit 4c8a12e

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/parsing.jl

+3-6
Original file line numberDiff line numberDiff line change
@@ -297,20 +297,17 @@ _DEFAULT_TYPE_MAP[:time] = Time
297297
function pqparse(::Type{Time}, str::AbstractString)
298298
@static if v"1.6.6" <= VERSION < v"1.7.0" || VERSION >= "1.7.2"
299299
result = tryparse(Time, str)
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
300+
# If there's an error we want to see it here
301+
return isnothing(result) ? parse(Time, _trunc_seconds(str)) : result
305302
else
306303
try
307304
return parse(Time, str)
308305
catch err
309306
if !(err isa InexactError)
310307
rethrow(err)
311308
end
312-
return parse(Time, _trunc_seconds(str))
313309
end
310+
return parse(Time, _trunc_seconds(str))
314311
end
315312
end
316313

0 commit comments

Comments
 (0)