
755 N.W.2d 920 (2008)
2008 ND 175
RAMSEY COUNTY FARM BUREAU and Dan Plemel, Plaintiffs and Appellants
v.
RAMSEY COUNTY, a political subdivision of the State of North Dakota, and Board of County Commissioners of Ramsey County, North Dakota, Defendants and Appellees.
No. 20080054.
Supreme Court of North Dakota.
September 23, 2008.
*921 John T. Shockley (argued) and Michael D. Nelson (on brief), Ohnstad Twichell, P.C., West Fargo, ND, for plaintiffs and appellants.
Daniel L. Gaustad (argued) and Ronald F. Fischer (on brief), Pearson Christensen & Clapp, PLLP, Grafton, ND, for defendants and appellees.
CROTHERS, Justice.
[¶ 1] Ramsey County Farm Bureau and Dan Plemel ("plaintiffs") appeal from a summary judgment dismissing their declaratory judgment action against Ramsey County and the Ramsey County Board of County Commissioners ("Ramsey County"). The plaintiffs argue the Ramsey County zoning ordinance regulating animal feeding operations is invalid because Ramsey County did not comply with post-enactment statutory publication requirements, the ordinance regulates matters preempted by state law, the ordinance is not a zoning ordinance and Ramsey County did not have authority to enact the ordinance. We conclude Ramsey County substantially complied with post-enactment *922 statutory publication requirements. We further conclude, however, the district court erred in declaring the validity of the ordinance under the repealed version of N.D.C.C. ch. 11-33, and we conclude Ramsey County exceeded its authority under the current law in enacting the ordinance. We affirm in part, reverse in part, and remand.

I
[¶ 2] In 2004, the Ramsey County Commission adopted an ordinance, Amendment # 1 to the Ramsey County Zoning Ordinance for Animal Feeding Operations, to regulate animal feeding operations within the county. In May 2006, the Ramsey County Commission contemplated changes to the ordinance and had the first reading of Amendment # 2 to the Ramsey County Ordinances for Large Animal Feeding Operations. On June 20, 2006, the Ramsey County Commission voted to adopt Amendment # 2; however, notice of the adopted ordinance was not published in the official county newspaper until March 23 and 30, 2007.
[¶ 3] On June 7, 2006, the plaintiffs brought a declaratory judgment action against Ramsey County seeking a declaration that Amendment # 1 is invalid and later amending the complaint to include a claim that Amendment # 2 is also invalid. The plaintiffs argued the ordinances are invalid because Ramsey County exceeded its authority under state law, the ordinances conflict with and are preempted by state law and Ramsey County did not satisfy post-enactment statutory publication requirements. Both parties moved for summary judgment.
[¶ 4] The district court granted Ramsey County's motion for summary judgment and dismissed the case. The court concluded Amendment # 1 was stricken in its entirety when Amendment # 2 was enacted; Ramsey County substantially complied with the statutory publication requirements and the plaintiffs were not prejudiced by the publication delay; Ramsey County did not exceed its zoning authority when it enacted Amendment #2; and state laws and regulations do not expressly or impliedly preempt the ability of Ramsey County to enact the zoning ordinance.

II
[¶ 5] On appeal, declaratory judgment actions are reviewed under the same standards as other cases. N.D.C.C. § 32-23-07; Nationwide Mut. Ins. Cos. v. Lagodinski, 2004 ND 147, ¶ 7, 683 N.W.2d 903.
[¶ 6] The standard of review for summary judgment is well-established, and this Court has explained:
"Summary judgment is a procedural device for promptly disposing of a lawsuit without a trial if there are no genuine issues of material fact or inferences which can reasonably be drawn from undisputed facts, or if the only issues to be resolved are questions of law. `Whether summary judgment was properly granted is "a question of law which we review de novo on the entire record.'" On appeal, this Court decides if the information available to the trial court precluded the existence of a genuine issue of material fact and entitled the moving party to summary judgment as a matter of law."
Peoples State Bank of Truman, Inc. v. Molstad Excavating, Inc., 2006 ND 183, ¶ 17, 721 N.W.2d 43 (quoting Zuger v. State, 2004 ND 16, ¶ 7, 673 N.W.2d 615).

III
[¶ 7] The plaintiffs argue Amendment # 2 is invalid because Ramsey County failed to comply with mandatory statutory publication requirements for enacting *923 county zoning ordinances, which require a county to immediately publish notice of the adopted ordinance in the official county newspaper. The plaintiffs contend notice of the ordinance was not published until approximately nine months after it was adopted and that the ordinance is therefore invalid.
[¶ 8] After adopting a zoning ordinance, N.D.C.C. § 11-33-09 requires a county to publish notice of the adopted ordinance in the official county newspaper:
"Upon adoption of any resolution or any amendment thereto, the county auditor shall file a certified copy thereof with the recorder. Immediately after the adoption of any such resolution or any amendment thereto, the county auditor shall cause notice of the same to be published for two successive weeks in the official newspaper of the county and in such other newspapers published in the county as the board of county commissioners may deem necessary. Said notice shall describe the nature, scope, and purpose of the adopted resolution, and shall state the times at which it will be available to the public for inspection and copying at the office of the recorder. Proof of such publication shall be filed in the office of the county auditor. If no petition for a separate hearing is filed pursuant to section 11-33-10, the resolution or amendment thereto shall take effect upon the expiration of the time for filing said petition."
[¶ 9] Ramsey County admits it did not strictly comply with N.D.C.C. § 11-33-09 because notice of the adoption of Amendment #2 was not published until March 2007. Ramsey County argues, however, it substantially complied with the post-enactment procedures, the plaintiffs had notice the ordinance had been approved and the plaintiffs have not claimed they were prejudiced by the failure to strictly comply with the statutory requirements.
[¶ 10] In Homer Twp. v. Zimney, 490 N.W.2d 256, 257 (N.D.1992), the township failed to comply with a statutory pre-enactment notice requirement because it did not publish notice of a meeting at which it passed an ordinance. This Court held the ordinance was invalid because the statutory pre-enactment notice requirement was mandatory and the township did not either strictly or substantially comply with the notice requirement. Id. at 259-60.
[¶ 11] In Pulkrabek v. Morton County, 389 N.W.2d 609, 611 (N.D.1986), the Pulkrabeks argued county ordinances were invalid because the county did not strictly comply with the county auditor's statutory general filing duty, requiring the auditor to index documents in a reception book to establish proof of publication. This Court concluded the county ordinances were effective even though the county did not strictly comply with the county auditor's statutory duties because the county satisfied the procedural requirements for zoning by filing proof of publication in a storage vault in the courthouse basement, which was sufficient to meet the requirement that proof be filed with the county auditor's office. Id. at 612.
[¶ 12] Thus this Court has considered whether an ordinance is invalid when statutory requirements have not been met, and we have held a county does not have to strictly comply with all post-enactment statutory procedures for enacting a valid zoning ordinance. This Court has said, "Procedural requirements contained in state zoning enabling statutes `are [generally] regarded as mandatory, and a substantial failure to comply will render an ordinance invalid.'" Homer Twp., 490 N.W.2d at 258 (emphasis added).
[¶ 13] Section 11-33-09, N.D.C.C., states, "[T]he county auditor *924 shall cause notice of the same to be published for two successive weeks in the official newspaper of the county...." Use of "[t]he word `shall' in a statute ordinarily creates a mandatory duty." Homer Twp., 490 N.W.2d at 259. Under the terms of N.D.C.C. § 11-33-09, a county has a mandatory duty to publish notice of an adopted ordinance, and the ordinance does not become effective until after the county has complied with that requirement. However, "[s]tatutory provisions concerning the performance of duties by public officers within a specified time are generally construed to be directory so that the interests of private parties and the public will not be injured because of the delay." Solen Pub. Sch. Dist. No. 3 v. Heisler, 381 N.W.2d 201, 204 (N.D. 1986). If mandatory construction is required, harsh, unfair, or absurd consequences may result. Id. The immediacy requirement is intended to ensure order and promptness, and without a showing of prejudice, non-compliance with the immediacy requirement alone will not invalidate the ordinance. Cf. id. (fifteen-day time period was intended to ensure order and promptness, and without a showing of prejudice, failure to strictly comply did not preclude action). We conclude N.D.C.C. § 11-33-09 creates a mandatory duty to publish the enacted ordinance before the ordinance becomes effective. See O'Hare v. Town of Park River, 1 N.D. 279, 280, 47 N.W. 380, 381 (1890) (proposed by-law did not become effective because it was never published). However, the immediate publication requirement is not mandatory and only necessitates substantial compliance.
[¶ 14] While Ramsey County did not immediately publish notice of the adopted ordinance in the official county newspaper, it did publish notice on its website and in the official county newspaper in March 2007. We conclude Ramsey County substantially complied with the notice requirements of N.D.C.C. § 11-33-09. Therefore, the ordinance became effective after both the notice was published in the official county newspaper and the time had expired for filing a petition for a separate hearing under N.D.C.C. § 11-33-10.
[¶ 15] Furthermore, we note that this is a declaratory judgment case and not an enforcement action and the plaintiffs have not demonstrated they were prejudiced by the delay. The plaintiffs do not dispute that Ramsey County complied with the pre-enactment statutory requirements, giving notice of the potential ordinance and of any meetings to discuss its enactment. The plaintiffs had actual notice of the ordinance and amended their complaint to include claims about Amendment # 2 shortly after the county commission adopted the ordinance. Additionally, the ordinance did not become effective and could not be enforced until notice was published and the county substantially complied with N.D.C.C. § 11-33-09.
[¶ 16] We conclude Ramsey County substantially complied with N.D.C.C. § 11-33-09 and the ordinance is not invalid for failure to strictly comply with the statutory publication requirement.

IV
[¶ 17] The plaintiffs argue Amendment # 2 is invalid because it conflicts with and regulates matters pre-empted by state law; Ramsey County did not have the authority to enact the ordinance; and the amendment is not a zoning ordinance but is instead a set of comprehensive regulations to license, permit, and monitor the health and potential air and water pollution aspects of animal feeding operations.
[¶ 18] Amendment # 2 is a comprehensive zoning ordinance for animal feeding operations. The purpose of the ordinance *925 is to protect Ramsey County from pollutants generated by animal feeding operations and to promote the health, safety and welfare of the citizens of Ramsey County. Amendment # 2 includes restrictions on air, soil and water pollution; registration requirements; permit conditions, including requirements for site assessment with soil borings or soil evaluations, an operation and maintenance plan, a nutrient utilization plan, closure requirements and closure plan, and fee requirements and financial assurances; requirements for monitoring the operation; record keeping requirements; setback requirements; and enforcement provisions. Although many of the requirements in the ordinance are similar to State Health Department regulations for controlling pollution from animal feeding operations, see N.D. Admin. Code ch. 33-16-03.1, Amendment # 2 provides additional regulations.
[¶ 19] A county has the authority and powers granted to it by law. N.D. Const. art. VII, § 2 ("Each political subdivision shall have and exercise such powers as provided by law."); City of Fargo v. Cass County, 286 N.W.2d 494, 500 (N.D. 1979). See also Burlington Northern and Santa Fe Ry. Co. v. Benson County Water Res. Dist., 2000 ND 182, ¶ 7, 618 N.W.2d 155 ("A political subdivision's `rights and powers are determined and defined by law.'"); Hart v. Bye, 76 N.W.2d 139, 144 (N.D.1956) (counties are political subdivisions). "[A] [county] cannot validly enact a zoning ordinance that contravenes federal or state law." Mountrail County v. Hoffman, 2000 ND 49, ¶ 7, 607 N.W.2d 901.
[¶ 20] When this suit was commenced in 2006, N.D.C.C. § 11-33-01 gave counties authority to enact zoning ordinances:
"For the purpose of promoting health, safety, morals, public convenience, general prosperity, and public welfare, the board of county commissioners of any county may regulate and restrict within the county, subject to section 11-33-20..., the location and the use of buildings and structures and the use, condition of use, or occupancy of lands for residence, recreation, and other purposes."
Section 11-33-02, N.D.C.C., limited a county's authority to enact zoning ordinances regulating concentrated feeding operations:
"2. A board of county commissioners may regulate the nature and scope of concentrated feeding operations permissible in the county....
"3. A regulation may not preclude the development of a concentrated feeding operation in the county. A regulation addressing the development of a concentrated feeding operation in the county may set reasonable standards, based on the size of the operation, to govern its location."
Section 23-25-11(9), N.D.C.C., explicitly limited a county's authority to regulate animal feeding operations: "Neither a county nor a township may regulate or through any means impose restrictions or requirements on animal feeding operations or on other agricultural operations except as permitted under sections 11-33-02 and 58-03-11."
[¶ 21] The district court applied the statutes in effect at the time the suit was commenced, concluded Ramsey County had the authority to enact Amendment # 2 and the ordinance was not pre-empted by state law, and granted Ramsey County's motion for summary judgment. The court concluded the county did not exceed its authority because Amendment # 2 regulates the nature, scope and location of animal feeding operations, which is permitted under N.D.C.C. ch. 11-33. The court also concluded the ordinance did not conflict with state law, rather it is more comprehensive *926 than state law and addresses several issues state law ignores.
[¶ 22] The purpose of the Declaratory Judgment Act is "to settle and to afford relief from uncertainty and insecurity with respect to rights, status, and other legal relations, and it is to be construed and administered liberally." N.D.C.C. § 32-23-12. In a declaratory judgment action "[t]he court may refuse to render or enter a declaratory judgment or decree where such judgment or decree, if rendered or entered, would not terminate the uncertainty or controversy giving rise to the proceeding." N.D.C.C. § 32-23-06. There must be a justiciable controversy, ripe for a judicial determination. See Saefke v. Stenehjem, 2003 ND 202, ¶ 12, 673 N.W.2d 41. "`The Uniform Declaratory Judgments Act does not give a court the power to render advisory opinions or determine questions not essential to the decision of an actual controversy.'" Richland County Water Res. Bd. v. Pribbernow, 442 N.W.2d 916, 918 (N.D.1989) (quoting Davis v. Dairyland County Mut. Ins. Co. of Texas, 582 S.W.2d 591, 593 (Tex.Civ.App.1979)).
[¶ 23] Chapter 11-33, N.D.C.C., which gives counties authority to enact zoning ordinances and places limits on those ordinances, was amended in 2007, and the amendments became effective August 1, 2007. However, the district court did not consider whether the ordinance is valid under this current version of the law. A valid statute repeals an earlier ordinance that conflicts with the statute because a county only has the authority granted to it, and that authority may be modified or taken away at the will of the Legislature. State ex rel. City of Minot v. Gronna, 79 N.D. 673, 59 N.W.2d 514, 530 (1953). Generally, in an enforcement action the validity of the ordinance at the time the action commences or when the cause of action accrues is important to resolving the case. See Homer Twp., 490 N.W.2d at 258 (a party may challenge the validity of a zoning ordinance as a defense in an enforcement action). Cf., White v. Altru Health Sys., 2008 ND 48, ¶ 11, 746 N.W.2d 173 (the date the cause of action accrued should be used to determine which version of a statute applies, because statutes generally do not apply retroactively). However, this is a declaratory judgment action to determine if Ramsey County's animal feeding operation ordinance is currently valid, and the current law must be used. Otherwise, our decision and that of the district court are theoretical and advisory statements about what the repealed law might have done. Cf. Jones v. Temmer, 57 F.3d 921, 922-23 (10th Cir.1995) (plaintiffs sought declaration of whether state statute was constitutional, while appeal was pending, the prior law was amended rendering complaint moot); Taxpayers For the Animas-La Plata Referendum v. Animas-La Plata Water Conservancy Dist., 739 F.2d 1472, 1478-79 (10th Cir.1984) (statute that validated water conservancy districts after a suit commenced challenging the formation of a district, mooted plaintiffs claims relating to the formation of the district).
[¶ 24] The district court's declaration regarding the validity of Amendment # 2 was based on the version of the statutes in effect at the time the action commenced, N.D.C.C. ch. 11-33 (2005). However, at the time of the court's decision, those provisions had been repealed by N.D.C.C. ch. 11-33 (2007); therefore, the question the court answered was moot. But the issue for which the plaintiffs sought review was not moot because the declaration could have and should have been made under the successor and current version of the law, N.D.C.C. ch. 11-33 (2007).
*927 [¶ 25] The 2007 amendments to N.D.C.C. ch. 11-33 clarify a county's authority to regulate concentrated feeding operations. Counties are statutorily granted the general authority to enact zoning ordinances under N.D.C.C. § 11-33-01, which provides:
"For the purpose of promoting health, safety, morals, public convenience, general prosperity, and public welfare, the board of county commissioners of any county may regulate and restrict within the county, subject to section 11-33-20 and chapter 54-21.3, the location and the use of buildings and structures and the use, condition or use, or occupancy of the lands for residence, recreation, and other purposes."
However, "a [county] cannot validly enact a zoning ordinance that contravenes federal or state law." Mountrail County v. Hoffman, 2000 ND 49, ¶ 7, 607 N.W.2d 901. Section 11-33-02, N.D.C.C., authorizes a county to divide the county into districts and to enact suitable regulations to carry out N.D.C.C. § 11-33-01, subject to the limits placed on the county in N.D.C.C. § 11-33-02.1. Section 11-33-02.1, N.D.C.C., limits a county's regulations regarding farming and ranching:
"1. For purposes of this section:
a. "Concentrated feeding operation" means any livestock feeding, handling, or holding operation, or feed yard, where animals are concentrated in an area that is not normally used for pasture or for growing crops and in which animal wastes may accumulate. The term does not include normal wintering operations for cattle.
. . . .
d. "Location" means the setback distance between a structure, fence, or other boundary enclosing a concentrated feeding operation, including its animal waste collection system, and the nearest occupied residence, the nearest buildings used for nonfarm or nonranch purposes, or the nearest land zoned for residential, recreational, or commercial purposes. The term does not include the setback distance for the application of manure or for the application of other recycled agricultural material under a nutrient management plan approved by the department of health.
. . . .
"4. A board of county commissioners may not preclude the development of a concentrated feeding operation in the county.
. . . .
"6. A board of county commissioners may adopt regulations that establish different standards for the location of concentrated feeding operations based on the size of the operation and the species and type being fed.
"7. If a regulation would impose a substantial economic burden on a concentrated feeding operation in existence before the effective date of the regulation, the board of county commissioners shall declare that the regulation is ineffective with respect to any concentrated feeding operation in existence before the effective date of the regulation.
"8. a. A board of county commissioners may establish high-density agricultural production districts in which setback distances for concentrated feeding operations and related agricultural operations are less than those in other districts.
b. A board of county commissioners may establish, around areas zoned for residential, recreational, or nonagricultural commercial uses, low-density agricultural production districts in which setback distances for concentrated *928 feeding operations and related agricultural operations are greater than those in other districts; provided, the low-density agricultural production districts may not extend more than one and one-half miles [2.40 kilometers] from the edge of the area zoned for residential, recreational, or nonagricultural commercial uses."
Section 23-25-11(9), N.D.C.C., states, "Neither a county nor a township may regulate or through any means impose restrictions or requirements on animal feeding operations or on other agricultural operations except as permitted under sections 11-33-02 and 58-03-11."
[¶ 26] A county only has the authority granted to it. N.D. Const. art. VII, § 2 ("Each political subdivision shall have and exercise such powers as provided by law."); City of Fargo v. Cass County, 286 N.W.2d 494, 500 (N.D.1979). Sections 11-33-02 and 11-33-02.1, N.D.C.C., give a county authority to regulate the location of animal feeding operations, the type of animals a feeding operation may contain and the size of the operation. Section 23-25-11(9), N.D.C.C., explicitly limits a county's authority to regulate animal feeding operations and states that a county may do no more than regulate the location of the operation, size of operation and type of animal. A county may not enact environmental regulations for animal feeding operations as part of its zoning ordinances. The Legislature gave the authority to adopt environmental regulations for animal feeding operations to the North Dakota Department of Health. See N.D.C.C. ch. 23-25 (air pollution control); N.D.C.C. ch. 61-28 (control, prevention, and abatement of pollution of surface waters), N.D. Admin. Code ch. 33-16-03.1 (Department of Health regulations to control pollution from animal feeding operations).
[¶ 27] We conclude Ramsey County exceeded its authority in enacting Amendment # 2 because the ordinance regulates more than the location of a feeding operation, the type of animals and size of the operation. Therefore Amendment #2 is invalid to the extent that it regulates more than N.D.C.C. ch. 11-33 (2007) authorizes. However, Amendment #2 provides, "If any paragraph, sentence, clause or phrase of this ordinance is for any reason held to be invalid or unconstitutional by a court of competent jurisdiction, such decision shall not affect the validity of the remaining portion of this ordinance." We reverse the district court's decision and remand for further proceedings to determine whether portions of the ordinance are still valid.

V
[¶ 28] We conclude Ramsey County substantially complied with post-enactment statutory publication requirements, but the district court erred by declaring the validity of Amendment # 2 under the repealed version of N.D.C.C. ch. 11-33. We further conclude Ramsey County exceeded its authority in enacting Amendment # 2 under the current law. We affirm in part, reverse in part, and remand for proceedings consistent with this opinion.
[¶ 29] GERALD W. VANDE WALLE, C.J., MARY MUEHLEN MARING, CAROL RONNING KAPSNER and DALE V. SANDSTROM, JJ., concur.
