Facts

The appellants are two nurses employed by public hospitals in the canton of Fribourg (personalised State institutions), namely an instrument nurse (case 8C_484/2017, appeal in public law matters) and a male nurse (case 8D_3/2017, subsidiary constitutional appeal). The respondents are the X. and [Y.] hospitals, their respective employers.

By ordinance of 22 December 2009, in force since 1 January 2010, the Cantonal Council of State of the canton of Fribourg amended the State Personnel Regulation (RPers) concerning night work and on-call duty, in order to comply with EmpA (full compensation for on-call duty and compensation for night work in time or in money). The preamble provided for a progressive entry into force, without retroactive effect, an agreement reached with the FEDE.

On 28 July 2010, the two employees claimed from their employer compensation for their night work and on-call duty for the period 2005-2009 (in particular 66 nights and 1'248 hours of on-call duty for the first; 841 nights for the second). The hospitals rejected these claims by decisions of 18 February 2013; the Council of State dismissed the appeals by decisions of 27 May 2015. The Cantonal Court of Fribourg, First Administrative Court, joined the cases and dismissed the appeals by judgment of 23 May 2017, holding that the non-retroactivity clause had to be challenged by an abstract appeal before the Federal Supreme Court within 30 days of the publication of the ordinance (art. 101 FSCA), so that the claims were out of time and brought before an incompetent authority.

The appellants submit that this ground had never been raised during the proceedings, which would violate their right to be heard (art. 29 para. 2 Cst.). They seek annulment of the cantonal judgment and remittal of the case for a decision on the merits. The hospitals seek dismissal, and the [Y.] hospital additionally argues that the constitutional appeal is inadmissible.

Considerations

The Federal Supreme Court first examines the available appeal route. The dispute falls within public-law employment relationships (art. 83 let. g FSCA). The appellant A. asserts pecuniary claims exceeding 15'000 francs, but bases her rights on art. 22 EmpA and in fact files a subsidiary constitutional appeal; the question of classification may remain open, since only constitutional complaints (art. 29 para. 2 and art. 9 Cst.) are raised and the conditions as to reasoning are identical. For B., who did not seek payment, the exception of art. 83 let. g FSCA applies and only the subsidiary constitutional appeal (art. 113 FSCA) is available.

On the merits, case law derives from art. 29 para. 2 Cst. the right of parties to comment on the relevant matters before any decision is taken. As regards the legal classification of the facts, this right applies only where the authority intends to base its decision on legal arguments unknown to the parties and which they could not have foreseen (ATF 126 I 19; 124 I 49). The court is therefore not required to flag every provision it contemplates, but only the unraised legal grounds whose relevance no party could have anticipated.

In this case, the ground adopted by the cantonal court, under which the appellants were out of time for failing to challenge the ordinance of 22 December 2009 by way of abstract review before the Federal Supreme Court within the 30-day period (art. 82 let. b, 100 and 101 FSCA), was entirely novel and unforeseeable. The appellants had never challenged the ordinance itself: they contested individual decisions based on federal law (art. 17b para. 2 and art. 22…