Fix date interval calculations