It’s helpful to provide dummy data for others to replicate the entirety of your example instead of guessing about the format of your data. Regardless, you’ll want to use extrema, which calculates minimum and maximum with one pass through an array rather than two. For a million rows, it takes about half as long:
get_delta0(x) = maximum(skipmissing(x)) - minimum(skipmissing(x))
get_delta1(x) = -(-(extrema(skipmissing(x))...))
julia> using BenchmarkTools
julia> @btime get_delta0($x)
8.716 ms (10 allocations: 160 bytes)
1.0
julia> @btime get_delta1($x)
4.877 ms (5 allocations: 112 bytes)
1.0
Just for fun, instead of defining get_delta_days, you can add a method for get_delta that operates only on vectors of DateTime:
get_delta(x::Vector{<:DateTime}) = -(-(extrema(x -> x.value, skipmissing(x))...))
julia> @btime get_delta_days($datestamp)
3.415 ms (10 allocations: 160 bytes)
2999602398
julia> @btime get_delta($datestamp)
2.195 ms (5 allocations: 112 bytes)
2999602398 days