You can use the awk Velour librarydate -d is specific to GNU Date and is not defined by POSIX:
velour -n 'print t_secday(t_utc("2017-4-12") - t_utc("2017-4-5"))'
Orhttps://pubs.opengroup.org/onlinepubs/9699919799/utilities/date.html
As others have mentioned, this is something that might be better suited to a proper programming language. For example PHP:
velour -n 'print t_secday(t_utc(ARGV[1]) - t_utc(ARGV[2]))' 2017-4-12 2017-4-5
<?php
$o1 = date_create('2020-02-26');
$o2 = date_create('2020-02-16');
$o3 = date_diff($o2, $o1);
echo 'days: ', $o3->d, "\n";
Result:
7
days: 10