How to clamp quaternions when using ECS?

How does quaternion clamping work? Everytime I have looked for an answer online, I usually just come across an answer from pre-ECS/MonoBehaviour only solutions which tell you to convert the angle to an euler angle, clamp the axis you want and convert it back. But ECS quaternions don’t have that feature.

I have a PlayerRotate component that looks like this:

public struct PlayerRotate : IComponentData {
        public float RotationSpeed;
        public float RotationValue;
        public float UpperClamp;
        public float LowerClamp;
    }

RotationSpeed is how fast the camera rotates, RotationValue is the current user input and then UpperClamp and LowerClamp are the angles in degrees of where the pitch should be clamped.
The only solution I found online that I thought would work was here and I tried to adapt it to use the Unity.Transform version but that didn’t do anything except lock off all pitch rotation. My adaptation:

private void Execute(ref LocalTransform pcTransform, in Components.PlayerRotate playerRotate, Tags.CameraPivot pivot) {

    quaternion q = pcTransform.RotateX(playerRotate.RotationSpeed * 
        playerRotate.RotationValue   * 
        DeltaTime).Rotation;

    q.value.x /= q.value.w;
    q.value.y /= q.value.w;
    q.value.z /= q.value.w;
    q.value.w = 1.0f;
               
    float angleX = 2.0f * (360 / (math.PI * 2)) * math.atan(q.value.x);
    angleX = math.clamp(angleX, 
        playerRotate.LowerClamp, 
        playerRotate.UpperClamp);
    q.value.x = math.tan(0.5f * ((math.PI * 2) / 360) * angleX);
               
    pcTransform.Rotation = q;
}

I’d appreciate any effort on the topic since I assume that angle clamping is not gonna be a somewhat common event that I have to handle.
Thanks in advanced

Don’t these help you?

https://docs.unity3d.com/Packages/com.unity.mathematics@1.3/api/Unity.Mathematics.math.EulerXYZ.html#Unity_Mathematics_math_EulerXYZ_Unity_Mathematics_quaternion_

https://docs.unity3d.com/Packages/com.unity.mathematics@1.3/api/Unity.Mathematics.quaternion.EulerXYZ.html#Unity_Mathematics_quaternion_EulerXYZ_System_Single_System_Single_System_Single_

So I don’t have that version of that function. The only version of that function I have takes floats to construct a quaternion not the other way around. Although the version of the mathematics package. I’m still on version 1.2.6. I’ll try to upgrade and see if that makes a difference

Edit: Updated the package and found the needed function. Thanks.