
26 Cal.App.3d 62 (1972)
102 Cal. Rptr. 661
HELEN HINSON, Plaintiff and Appellant,
v.
NICK DELIS, Defendant and Respondent.
Docket No. 29503.
Court of Appeals of California, First District, Division Three.
June 15, 1972.
*64 COUNSEL
Myron Moskovitz and Marcus R. Peppard for Plaintiff and Appellant.
No appearance for Defendant and Respondent.
OPINION
CALDECOTT, J.
On or about November 10, 1968, appellant Hinson, the tenant, took possession of an apartment in the City of Richmond, pursuant to a written month-to-month rental agreement with respondent Delis, the landlord. The monthly rental was $90. Apparently the apartment was in adequate condition at this time, with the exception of the improperly fitted glass in the front door.
In the early part of November 1969, through no fault of the tenant or her children, the floor in her bathroom began to weaken, apparently from dry rot, and a hole soon developed in the floor. In early November, when she paid her November rent, the tenant informed the landlord's resident manager about the hole. Neither the landlord nor his manager did anything to fix the floor and, in late November, the tenant fell through the hole and allegedly hurt her back. Between December 1, 1969, and the end of January 1970, the tenant fell on two other occasions due to the hole in the floor of the bathroom. On February 4, 1970, the tenant's 10-year-old son fell in the bathroom because of the hole.
During the tenant's occupancy, other defects in the apartment existed at various times. The toilet had begun leaking in the summer of 1969, causing foul odors, requiring the tenant to continually mop the bathroom floor, and requiring her to keep a plastic tub behind the toilet to catch the dripping water. The glass in the tenant's front door never fitted properly and allowed a constant draft to enter the apartment. The linoleum in the kitchen failed to provide a continuous water-repellent surface. On *65 several occasions, the tenant informed the landlord's manager of the defective toilet and front door.
Had the tenant hired a contractor to repair these defects, the cost to her would have been over $300. Her sole source of income from November 1, 1969 to April 1, 1970, was an Aid to Families with Dependent Children (AFDC) grant of $172 per month for her two minor children and an Aid to the Totally Disabled (ATD) grant of $158 per month for herself. During this period, she actively looked for other housing for herself and her children in the Richmond-San Pablo area but was unsuccessful because of the scarcity of units available to low-income persons in that area. The affidavit of Kenneth H. Smith, City Manager of Richmond, showed an estimate of only 40 standard vacant units available to low-income people, and that the housing authority had over 400 applicants on its waiting list for these units.
On February 5, 1970, the day after her son fell in the bathroom, the tenant informed the landlord's manager that she would pay the $20 she owed on her January rent and the February rent only after the landlord made proper repairs.
On or about February 8, 1970, the landlord's manager covered the hole in the bathroom with the end of a wooden orange crate. The orange crate end was not covered with linoleum and was not level with the linoleum covering the rest of the floor. On March 1, the tenant tripped on the lip of the linoleum surrounding the orange crate end and again fell.
The next day, on March 2, 1970, the tenant requested the Conservation Section of the City of Richmond to conduct an inspection of her apartment. On March 3, Conservation Representative Levy conducted the requested inspection and confirmed the defects in the bathroom (the floor and toilet), the kitchen, the front door, and found that these defects constituted violations of the housing code of the City of Richmond.
The tenant refused to pay the $20 due on her January rent, the $90 February rent, and the $90 March rent, a total of $200. On March 12, the landlord served on the tenant a three-day notice to pay rent or quit.
On March 20, the tenant filed this action in the superior court, alleging the above facts. The tenant requested that the landlord be enjoined from filing any eviction action based on nonpayment of rent during the pendency of the action and prayed for a declaratory judgment that the tenant is obliged to pay her full rent only after the landlord complies with his duty to substantially obey the housing codes. The landlord was served with the complaint and an order to show cause on March 26.
*66 On March 24, Conservation Representative Levy wrote a letter to the landlord stating his findings of the defects. The landlord received this letter on March 25. On March 28, 1970, the landlord's manager made the repairs. He replaced the toilet and installed new linoleum in the bathroom, replaced the window in the front door, and installed new linoleum in the kitchen. On March 31, Conservation Representative Levy again inspected the premises. This time, he found them to be in substantial compliance with the housing code of the City of Richmond.
On April 21, the landlord and the tenant filed a stipulation wherein they agreed that, during the pendency of this action, the landlord would not attempt to evict the tenant for nonpayment of the $200 withheld rent, and that the tenant would resume making her regular monthly rent payments as of April 1, 1970.
The court entered its findings of fact and conclusions of law following the default of the landlord. The court decided that this was a proper case for declaratory relief in that "there exists a controversy as to the rights and duties of the parties under a written agreement and regarding their specific obligations and rights over or upon property." The court held that the City of Richmond building code and the state housing law were enacted for the protection of the life, health, safety and property of the general public and owners and occupants of places of habitation; that the premises occupied by the tenant contained defects which constituted substantial violations of the Richmond building code from November 1, 1969 to April 1, 1970; and that these defects were not caused by the tenant. The court, however, held that the tenant had no legal or equitable right to unilaterally withhold rent and judgment was entered in favor of the landlord. The appeal is from the judgment.

Was the lease agreement an illegal contract which is void and unenforceable?
The rationale of the illegal contract theory was set forth in Shephard v. Lerner (1960) 182 Cal. App.2d 746 [6 Cal. Rptr. 433]. In that case, both parties knew that numerous violations of the municipal code and state housing act existed in the hotel-apartment which was the subject of the lease. The trial court found that because the lease was knowingly made by both parties to continue hotel and apartment use in contravention of the local ordinances and state statutes, the parties were in pari delicto; and since the contract was for an illegal purpose, no enforceable duties or rights could arise. The landlord was therefore prohibited from collecting rent. After discussing several similar cases, the court explained the reason for the rule: "In these cases, the underlying transactions involved *67 a violation of law and the courts considered them to be against public policy. The rule does not rest upon considerations of justice between the parties but on the principle that public policy requires that certain transactions be discouraged. The same policy considerations apply with equal force to contracts that involve a violation of valid regulations designed to promote public health and safety." (182 Cal. App.2d at pp. 750-751.)
Similar to Shephard was Howell v. City of Hamburg Co. (1913) 165 Cal. 172 [131 P. 130], in which local fire ordinances prohibited the construction of a wood frame and corrugated iron building. The court declined to enforce the lease against the tenant, even after he had lived there for several years, holding that because the lease contemplated the construction of a building in violation of local law, the agreement "was founded upon an unlawful consideration, and ... the entire contract was therefore void and unenforceable." (Id. at p. 176.)
The District of Columbia Court of Appeals has extended these principles into the area of present-day landlord-tenant relationships. In the case of Brown v. Southall Realty Company (D.C.Mun.App. 1968) 237 A.2d 834, the landlord brought an action for possession against the tenant, alleging nonpayment of rent in the amount of $230. The tenant contended, however, that no rent was due because the lease was an illegal contract, since the premises contained numerous violations of the housing codes. The court relied on several sections of the District of Columbia housing code which forbade a landlord from renting the premises if they are in violation of the code, and stated that where the conditions constituting a violation exist on a leasehold prior to an agreement to lease, the housing code implies a prohibition so as to render the prohibited act void.[1] (Id. at p. 837.)
(1) In the instant case, unlike Brown, the defects which constituted the violations of the housing codes developed during the period of occupancy. In Shephard and in most of the illegal contract cases, both parties knew of and willingly acquiesced in the illegality, distinguishing those cases from the present case in which the tenant did not acquiesce in the existence and maintenance of the illegal condition. Furthermore, the housing code violations did not exist prior to the execution of the lease; and apparently at the inception of the lease, with the minor exception noted above, the premises conformed to code and no illegality existed.
*68 The above cases seem only to contemplate a complete termination of the lease. In the present case the tenant does not wish to terminate the lease, but desires to remain in possession of the premises, with the housing code violations repaired. Thus the application of the principle of illegal contract, even if applicable, would be of no help to this tenant.

Does the doctrine of "unclean hands" prevent the landlord from using the powers of the equity court to evict tenant?
(2) The parties entered into a stipulation that the landlord would not evict the tenant during the pendency of the proceedings. Because the second cause of action of the complaint requested an injunction against eviction only during the pendency of the proceedings, the parties' stipulation has rendered moot any issue relating to eviction. We therefore need not discuss appellant's contentions with respect to the landlord's "unclean hands" as a defense to eviction.

Did the lease agreement between the landlord and the tenant contain an implied warranty of habitability?
(3a) Appellant's contention that the lease contained an implied warranty of habitability (also termed an implied warranty of fitness) is an issue of first impression in this state. This court, however, is not without guidance; a number of courts have found an implied warranty of habitability to exist in the landlord-tenant situation.
In 1961, the Supreme Court of Wisconsin decided the case of Pines v. Perssion (1961) 14 Wis.2d 590 [111 N.W.2d 409]. In that case, the building contained numerous building code violations, and it was in a "filthy" condition. After signing the lease, the tenants lived in the premises for only a short while before moving out. They alleged there was a total failure of consideration, and that they owed no rent. In deciding in the tenants' favor, the court held that the legislative enactment of building and health codes had placed duties upon the landlord, and that the court would find an implied warranty of habitability in the lease. In so holding, the court stated that "... the frame of reference in which the old common law rule operated has changed. [Paragraph.] Legislation and administrative rules, such as the safeplace statute, building codes and health regulations, all impose certain duties on a property owner with respect to the condition of his premises. Thus, the legislature has made a policy judgment  that it is socially (and politically) desirable to impose these duties on a property owner  which has rendered the old common law rule obsolete. To follow the old rule of no implied warranty of habitability in leases would, in our opinion, be inconsistent with the current *69 legislative policy concerning housing standards. The need and social desirability of adequate housing for people in this era of rapid population increases is too important to be rebuffed by that obnoxious legal cliche, caveat emptor." (111 N.W.2d at pp. 412-413.)[2] Although the court found that the tenants owed nothing on the lease, it did determine that they were liable for the reasonable rental value of the premises during the time of actual occupancy, and the court remanded the case for a determination of this amount.
In 1969, the Supreme Court of Hawaii, in the case of Lemle v. Breeden, 51 Hawaii 426, 478 [462 P.2d 470], adopted the implied warranty of habitability theory. In that case the court stated, at page 474: "The application of an implied warranty of habitability in leases gives recognition to the changes in leasing transactions today. It affirms the fact that a lease is, in essence, a sale as well as a transfer of an estate in land and is, more importantly, a contractual relationship. From that contractual relationship an implied warranty of habitability and fitness for the purposes intended is a just and necessary implication." The court further stated at page 475: "By adopting the view that a lease is essentially a contractual relationship with an implied warranty of habitability and fitness, a more consistent and responsive set of remedies are available for a tenant. They are the basic contract remedies of damages, reformation, and rescission. These remedies would give the tenant a wide range of alternatives in seeking to resolve his alleged grievance."
The court also commented on the limitations in the doctrine of constructive eviction in this type of case. The court pointed out that the doctrine of constructive eviction requires that the tenant abandon the premises within a reasonable time after giving notice that the premises are uninhabitable or unfit for his purposes. Abandonment is always at the risk of establishing sufficient facts to constitute constructive eviction or the tenant will be liable for breach of the rental agreement. Also the tenant is forced to gamble on the time factor as he must abandon within a "reasonable" time or be deemed to have "waived" the defects.
Some courts have allowed for alternatives to the abandonment requirement by allowing for a declaration of constructive eviction in equity without forcing abandonment. Other courts have found partial constructive eviction where alternative housing was scarce, thus allowing the tenant to remain in at least part of the premises. To continue the use of such *70 judicial fictions, however, is unnecessary when preferable alternatives exist.
A similar approach was adopted by the Supreme Court of New Jersey in Reste Realty Corporation v. Cooper (1969) 53 N.J. 444 [251 A.2d 268, 33 A.L.R.3d 1341]. Although nominally decided on constructive eviction grounds, the court made it clear that it felt an implied warranty of habitability should be applied. In Marini v. Ireland (1970) 56 N.J. 130 [265 A.2d 526, 40 A.L.R.3d 1356], the same court held that implied warranty of habitability was available as a defense to an unlawful detainer action.
In Javins v. First National Realty Corporation (1970) 428 F.2d 1071 [138 App.D.C. 369] at page 1080, the court stated: "Contract principles established in other areas of the law provide a more rational framework for the apportionment of landlord-tenant responsibilities; they strongly suggest that a warranty of habitability be implied into all contracts for urban dwellings."
While it is true that an implied warranty of habitability has not previously been adopted in California, implied warranties are not new in this state, even with regard to real property (see Kriegler v. Eichler Homes, Inc., 269 Cal. App.2d 224 [74 Cal. Rptr. 749]; Avner v. Longridge Estates, 272 Cal. App.2d 607 [77 Cal. Rptr. 633]), and there is a growing body of law recognizing the full scope of the landlord's duties with respect to maintenance of the condition of his leased or rented premises. (Ewing v. Balan, 168 Cal. App.2d 619 [336 P.2d 561]; McNally v. Ward, 192 Cal. App.2d 871 [14 Cal. Rptr. 260].)
The implied warranty cases described above permit the most equitable remedy, in that the tenant is not absolved from all liability for rent, but remains liable for the reasonable rental value of the premises, as determined by the trial court, for such time as the premises were in violation of the housing codes. (4) In considering the materiality of an alleged breach, both the seriousness of the claimed defect and the length of time for which it persists are relevant factors. Minor housing code violations standing alone which do not affect habitability must be considered de minimis and will not entitle the tenant to reduction in rent; and likewise, the violation must be relevant and affect the tenant's apartment or the common areas which he uses. Moreover, the contract principle that no one may benefit from his own wrong will permit the landlord to defend against damage caused by the tenant's wrongful action. (Javins v. First National Realty Corporation, supra, 428 F.2d 1071.) The tenant must also give notice of alleged defects to the landlord and allow a reasonable time for repairs to be made.
*71 If the tenant claims that all or a part of the rent is not due because of defects in the premises, the trial court may, during the pendency of the action and at the request of either party, require the tenant to make the rental payments at the contract rate into court as they become due for as long as the tenant remains in possession. At the trial of the action the court can then determine how the rent paid into court should be distributed.
In view of our conclusions above, the other points raised by the appellant need not be discussed.
(3b) In the present case, the plaintiff sought a judicial declaration that she "is obliged to make rental payments only after the defendant complies with his duty to substantially obey the housing codes and make the premises habitable." It was the judgment of the trial court that she was not entitled to such a declaration. This judgment, for the reasons stated above, was in error.
The judgment is reversed and the case is remanded to the trial court for further proceedings consistent with this opinion.
Draper, P.J., and Brown (H.C.), J., concurred.
NOTES
[1]  Cf. Diamond Housing Corporation v. Robinson (D.C.Mun.App. 1969) 257 A.2d 492) decided subsequent to Brown, supra, in which the court stated that a "technical or minor violation would not render the lease void." (Id. at p. 494.)
[2]  The above language from Pines was cited in Buckner v. Azulai (1967) 251 Cal. App.2d Supp. 1013 [59 Cal. Rptr. 806, 27 A.L.R.3d 920]. However, the holding of that case related to waiver of the provisions of Civil Code section 1941, not breach of implied warranty.
