fixed date parsing and calculation bugs