
434 N.W.2d 376 (1989)
Marlow James BROWN, Plaintiff and Appellant,
v.
The CITY OF YANKTON, a Municipal Corporation, Defendant and Appellee.
No. 16078.
Supreme Court of South Dakota.
Considered on Briefs December 1, 1988.
Decided January 18, 1989.
*377 David C. Humphrey of Humphrey Law Office, Yankton, for plaintiff and appellant.
James T. Goetz of Goetz, Hirsch and Klimisch, Yankton, for defendant and appellee.
SABERS, Justice.
Marlow Brown (Brown) claims his damages for wrongful discharge under the South Dakota Veteran's Preference Statute (SDCL ch. 3-3) should be measured from date of dismissal rather than date of application for relief.

Facts
Brown was hired as a custodian by the City of Yankton (City) in mid-1979. He was employed by the City on an indefinite basis until his dismissal on July 16, 1985.[1] City knew that Brown was an honorably discharged veteran of the Korean Conflict, but failed to comply with SDCL 3-3-4 in dismissing Brown from his employment.[2]
Brown brought suit against the City for wrongful discharge in May of 1986. However, Brown made no claim under SDCL ch. 3-3 until June 9, 1987, when he caused an application for writ of mandamus to be served on the City Manager. A hearing was held on the writ on September 4, 1987. A separate hearing on the issue of damages was held on September 22, 1987. The court reinstated Brown to his former position with the City on November 18, 1987. The court also awarded him damages for the period from June 9, 1987 through November 20, 1987. The damages were determined by calculating the amount of pay and fringe benefits Brown would have received from the City during this period, less income Brown received from other employment during the same period. Brown appeals the award of damages, claiming they should have been measured from the date of dismissal, rather than the date of application for relief. We affirm.

1. Measurement of Damages.

SDCL 3-3-3 provides that mandamus relief is available for persons grieved under SDCL ch. 3-3. While the chapter does not specifically provide for damages for wrongful discharge of a veteran, mandamus may issue to compel performance of an act and to award damages. SDCL 21-29-10; SDCL 21-29-12. Brown cites several cases to support his claim for damages from date of dismissal. Johnson v. Village of Cohasset, 263 Minn. 425, 116 N.W.2d 692 (1962); State ex rel. Lund v. City of Bemidji, 209 Minn. 91, 295 N.W. 514 (1940). While these *378 cases permit damages from the date of dismissal under Veteran's Preference Statutes, none address the situation where a veteran delayed asserting such rights.
Several courts have addressed this question under the Universal Military Training and Service Act, 50 U.S.C.App. § 459. These courts have generally held that where delay is attributable to the veteran in enforcing his veteran's rights, damages should commence from the date of the initiation of the action. Special Service Co. v. Delaney, 172 F.2d 16 (5th Cir.1949); Walsh v. Chicago Bridge & Iron Co., 90 F.Supp. 322 (N.D.Ill.1949); Noble v. International Nickel Co., 77 F.Supp. 352 (S.D.W.Va. 1948); Karas v. Klein, 70 F.Supp. 469 (D.Minn.1947). Brown distinguishes these cases because the act relates to re-employment of a veteran returning from active duty to his previous position with a private employer. Despite this distinction, the cases stand for the proposition that damages should be limited where a veteran delays asserting his claim to re-employment for an unreasonable period. As stated in Walsh:
In the exercise of this discretion, the courts have uniformly decided that a veteran who delays filing his suit for reinstatement can recover damages only for a period beginning after the date on which the suit is commenced.
Id. at 327.
Brown also cites SDCL 21-2-1 which provides that an aggrieved party should be awarded damages for any harm proximately caused by the breach. He cites several cases which state the general rule that damages for breach of a contract should be awarded from the date of breach. Osterkamp v. Alkota Manufacturing, Inc., 332 N.W.2d 275 (S.D.1983); Goodwyn v. Sencore Inc., 389 F.Supp. 824 (D.S.D. 1975). This rule is subject to the doctrine that the injured party will not be awarded damages for losses which the party could have and should have prevented. Gardner v. Welch, 21 S.D. 151, 110 N.W. 110 (1906). Brown failed to mitigate his damages for nearly two years before asserting a claim for reinstatement under SDCL ch. 3-3.
Brown's arguments also fail to consider the nature of a mandamus action. Although mandamus is normally considered a legal remedy, the action is guided by the rules of equity. United States ex rel. Girard Trust Co. v. Helvering, 301 U.S. 540, 57 S.Ct. 855, 81 L.Ed. 1272 (1937); Nationwide Corp. v. Northwestern Nat'l Life Ins. Co., 251 Minn. 255, 87 N.W.2d 671 (1958). As stated in State ex rel. Moore v. Sanders, 65 Ohio St.2d 72, 74-75, 418 N.E. 2d 1339, 1341 (1981):
A court, in the exercise of its discretion, may refuse to issue a writ of mandamus in favor of [one] who has allowed an unreasonable time to elapse before bringing the action, especially where such delay may be prejudicial to the rights of the respondent.
"In determining what constitutes such unreasonable delay as will justify refusal of the writ, regard must be had to the facts and circumstances of each particular case, to the character of the relief demanded, and to the detriment, prejudice, or injury, if any, to the respondent, or other interested person, or to the public from the delay." 52 Am.Jur.2d Mandamus, § 383 (1970). The City was prejudiced by Brown's failure to assert his veteran's rights within a reasonable period. Under these circumstances, the court did not abuse its discretion in limiting damages to the period beginning from the date that Brown commenced his mandamus action under SDCL ch. 3-3 for reinstatement.[3]
Brown argues that City's defense is essentially that of laches and that laches is an affirmative defense which the City failed to plead. The fact that an affirmative defense is not formally pled is immaterial where the defense is tried by express or implied consent. Beyer v. Cordell, 420 N.W.2d 767 (S.D.1988); Schecher v. Shakstad *379 Electric & Machine Works, Inc., 414 N.W.2d 303 (S.D.1987). The question of laches arose from Brown's delay in filing the mandamus action. Both parties had a sufficient opportunity to address the issue at the hearing on damages. It was tried by the consent of the parties and was not waived by failure to formally plead the defense.

2. Prejudgment interest.

Brown claims that he is entitled to prejudgment interest on his damages under SDCL 21-1-11. He argues that his damages are certain or capable of being made certain by calculation and that he is entitled to interest under the statute. To this extent, we agree. Heer v. State, 432 N.W. 2d 559 (S.D.1988); Arcon Constr. Co. v. South Dakota Cement Plant, 405 N.W.2d 45 (S.D.1987). However, Brown failed to demand prejudgment interest in the pleadings. Despite this he argues that the court should grant prejudgment interest where a claimant is entitled to such relief. SDCL 15-6-54(c); American Property Services, Inc. v. Barringer, 256 N.W.2d 887 (S.D. 1977).
American Property Services provides that the trial court should grant prejudgment interest if entitlement is shown by the facts and circumstances at trial. Such relief is available even though the party has not demanded it in the pleadings. American Property Services, supra. However, the rule implies that the claim, though not pled, was presented to or acted upon by the trial court. In this case, prejudgment interest was never presented to or addressed by the trial court prior to final judgment, and we are precluded from considering the issue. State v. Sickler, 334 N.W.2d 677 (S.D.1983); American Fed. Sav. & Loan Ass'n, etc. v. Kass, 320 N.W. 2d 800 (S.D.1982).
AFFIRMED.
All the Justices concur.
NOTES
[1]  Brown was in the Veteran's Administration Hospital at the time of his dismissal on July 16, and was unable to return to work until August 1, 1985. Under the City's extended sick leave policy, Brown could not receive pay until that date. Thus, his claim for damages is from August 1, rather than July 16.
[2]  SDCL 3-3-4 provides:

No person holding a public position by appointment or employment, and belonging to any of the classes of persons to whom a preference is herein granted, shall be removed from such position or employment unless replaced by another person of a class to whom preference is herein granted except for incompetency or misconduct shown after a hearing, upon due notice, upon stated charges, and with the right of such employee or appointee to a review by writ of certiorari. The burden of proving incompetency or misconduct shall rest upon the party alleging the same.
The City replaced Brown with a non-veteran without charging Brown with incompetency or misconduct and without holding a hearing.
[3]  Whether damages for violation of SDCL ch. 3-3 should be measured from the date of application for relief or from the date of dismissal is dependent on the facts and circumstances of each case. In circumstances where a veteran has not unreasonably delayed bringing an action under SDCL ch. 3-3, a court may award damages from the date of dismissal.
