Fix negative date calculation in firefox