Character mistake: At the scene at the dinner table where Pat and Tiffany meet, the prescription drug "Trazadone" is mispronounced with a long A as in "trayzadone." This a fairly common drug used for depression and as a sleep aid. Any nurse or pharmacist could tell you the correct pronunciation. Interestingly, the other lesser known drugs were pronounced correctly.
Character mistake: Robert DeNiro says that the Eagles beat the Seahawks 27-10. In a later scene, Jennifer Lawrence comments that the Eagles beat the Seahawks 14-7. Both scores were wrong, as the Eagles beat the Seahawks 26-7 that season.
Answer: It's not exactly common, but yes, it would be up to the judge, and establishing that a person is a "clear and present danger to themselves or others" can result in involuntary commitment in Pennsylvania, where the film takes place. In this case, it would not be hard to argue that, "the person has inflicted or attempted to inflict serious bodily harm on another and that there is a reasonable probability that such conduct will be repeated" (50 PA. CONS. STAT. ANN. ยง 7301 (b) (1)), as he had just physically assaulted his wife's lover and she'd obtained a restraining order. His mental health problems would have been well-documented, so it would have been easy for a judge to order him to undergo psychiatric evaluation, which could (and, in the film, does) lead to extended involuntary commitment at the discretion of a mental health professional.