Prefer 'up' for euler conversion

I have a box which rotates only around its Y axis. I want to change the contents of the box depending on which two faces are visible to the camera (it has a fixed offset from the box).
To get a sense of the ranges provided by the euler conversion I debugged it as shown here:

this.magicBox.rotateLocal(0, dt * 45.0, 0);
let ry = this.magicBox.getLocalRotation().getEulerAngles().y;

I see that the y values go from 0 to 90 to 0 to -90 to 0 again. The intuitive expectation is that they should range from 0 to 180 then instantly flip to -180 and climb back to 0 again.
I suspect this is because quaternions have that extra dimension of freedom and the conversion gave several possible solutions. In this case I expect that both X and Z have been flipped, essentially reversing the axis of Y.
Is there an alternative to getEulerAngles() which uses the generally useful convention of ‘preferring’ the upwards interpretation when picking a solution? I seem to remember Unity does this with a simple boolean flag.

I’m going to look in the docs tomorrow to see if there’s a relatively simple camera function which will tell me straight out whether a face is visible or not… but if I can do it this way it should just be four range checks.