A law to force social landlords to investigate and fix hazards within a set timescale will be phased in from October, the government has announced.