Facts

Parties and courts: The two cases (8C_484/2017 and 8D_3/2017) concern two operating-room nurses or nurses employed by autonomous public institutions of the State of Fribourg, namely the hospital X. and the hospital Y. They are represented by the same lawyers. The appellant [A.] lodges a public law appeal, reclassified as a subsidiary constitutional appeal, and the appellant [B.] a subsidiary constitutional appeal. Both appeals are directed against the judgment of the Cantonal Court of Fribourg, First Administrative Court, of 23 May 2017.

Regulatory framework: By ordinance of 22 December 2009, effective 1 January 2010, the Council of State of the canton of Fribourg amended the State Personnel Regulations (RPers) concerning night work and on-call duty. These amendments aimed to bring cantonal law into conformity with the federal Labour Act (EmpA), which had since 2000 and 2003 required full compensation for on-call duty and compensation in money or time depending on the number of nights. The new provisions (Art. 47a RPers) provided for progressive compensation of 110% from 2010, then of 110% or 115% depending on age from 2013. The preamble of the ordinance specified that these provisions would take effect only progressively and without retroactive effect, which the FEDE, the staff federation, had accepted. An ordinance of 11 December 2012 subsequently improved compensation, but the Council of State made the improvements conditional on the withdrawal of retroactivity claims, the FEDE undertaking in writing not to file new claims.

Procedure: On 28 July 2010, A. (operating-room nurse) claimed from the hospital X. compensation for 66 nights (462 hours) by way of 10% rest, compensation for 41 nights by way of a 25% supplementary salary (CHF 1'912.40), and payment for 1'248 hours of on-call duty (CHF 58'922) for the period 2005-2009. B. (nurse) claimed from the hospital Y. compensation for 841 nights (5'887 hours) by way of 10% rest for the years 2005 to 2009. Both claims were dismissed by decisions of 18 February 2013. The Council of State dismissed their appeals on 27 May 2015. The Cantonal Court joined the cases and dismissed the appeals by judgment of 23 May 2017. [A.] seeks annulment of the judgment and remand to the Cantonal Court so that it rules on the merits. [B.] seeks the same. The hospitals seek dismissal, or respectively inadmissibility.

Reasoning of the cantonal judgment: The Cantonal Court held that the preamble of the ordinance of 22 December 2009 constituted a general decision incorporated into a cantonal normative act, challengeable before the Federal Supreme Court by an abstract appeal within 30 days from its publication (Art. 101 FSCA), that is from 1 January 2010. The parties, who acted on 28 July 2010 before an incompetent employer, would therefore have acted late and before an incompetent authority. The claims should have been declared inadmissible by the hospitals.

Appellants' grievances: The appellants allege a violation of the right to be heard (Art. 29 para. 2 Cst.): the cantonal court would have based its judgment on a legal ground never raised during the seven years of proceedings, without inviting them to comment. They also contest the compensation, invoking Art. 17b para. 2 EmpA and Art. 22 EmpA.

Considerations

Classification of the appeal route: The Federal Supreme Court notes that disputes concerning public law employment relationships within the meaning of Art. 83 let. g FSCA apply, the hospitals being part of the autonomous public institutions of the State (Art. 2 FPA and Art. 2 RPers). For [A.], whose pecuniary claims exceed CHF 15'000, the public law appeal route is excluded by Art. 83 let. g FSCA and the appeal must be treated as a subsidiary constitutional appeal. For [B.], the dispute is not pecuniary and only the subsidiary constitutional appeal route comes into consideration (Art. 113 FSCA). The question of classification may remain open, since the conditions of reasoning and the scope of review are identical in the case of constitutional grievances (Art. 29 para. 2 Cst., Art. 9 Cst.).

Principles on the right to be heard: According to case law based on Art. 29 para. 2 Cst., the parties must be able to express themselves on the relevant elements before a decision affecting their legal situation is taken. For questions of fact, this right applies without restriction. For the legal characterisation of facts, it applies only where a party unexpectedly changes its legal viewpoint or where the authority intends to rely on legal arguments unknown to the parties, the adoption of which they could not foresee (ATF 126 I 19; ATF 124 I 49).

Application to the present case: The Federal Supreme Court finds that the reasoning of the cantonal court, according to which the appellants were time-barred for the years prior to…