Section 582 If the parties have not fixed the duration of the contract, either party can terminate it by giving notice at or before any time of payment to take effect at the following time of payment but no more than three-month notice need be given.