The service of a notice to quit upon a tenant or person in possession does not authorize an action to be maintained against the tenant or person for the possession of the premises until the expiration of the period for which that tenant or person may have paid rent for the premises in advance. To authorize an action against a tenant or person in possession who has paid rent in advance, a notice must be given at least 10 days before the date the rent is due again in case of a month-to-month tenancy or at least three days before in the case of a week-to-week tenancy.