fix date calculation on firefox