Israel has agreed to a US proposal for a temporary ceasefire in Gaza that would last throughout the holy periods of Ramadan and Passover.