BabylonJS - toEulerAngles BUG

http://www.html5gamedevs.com/topic/3159-quaternionrotationyawpitchroll-parameters-and-toeulerangles-result-should-be-the-same/

HTML

<script src="https://rawgithub.com/BabylonJS/Babylon.js/v1.8.5/babylon.1.8.5.js"></script>
<button id="euclideanspace">Use euclideanspace conversions</button>
<button id="babylonjs">Use babylon js conversions</button><br/>
<span class="rotationValue" id="rotationValueX">X : <input step="0.1" type="number" value="0" id="valueX" /></span>
<span class="rotationValue" id="rotationValueY">Y : <input step="0.1" type="number" value="0" id="valueY" /></span>
<span class="rotationValue" id="rotationValueZ">Z : <input step="0.1" type="number" value="0" id="valueZ" /></span>

<div id="rootDiv">
  <canvas id="renderCanvas"></canvas>
  <canvas id="canvas_2D"></canvas>
</div>

CSS

html, body, div, canvas {
    width: 100%;
    height: 100%;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

button { height: 20px; }

#canvas_2D {
    position: absolute;   
    top: 40px;
    pointer-events: none;
}

JavaScript

//////////////////
// GUI Callback //
//////////////////

$("#euclideanspace").click(function() {
    BABYLON.Quaternion.RotationYawPitchRollToRef = ES_RotationYawPitchRollToRef;
    BABYLON.Quaternion.prototype.toEulerAngles = ES_toEulerAngles;
    BABYLON.Quaternion.prototype.toRotationMatrix = ES_toRotationMatrix;
    BABYLON.Matrix.prototype.toQuaternion = ES_toQuaternion;    
    
    model.computeWorldMatrix(true);
    camera._getViewMatrix();
});

$("#babylonjs").click(function() {
    BABYLON.Quaternion.RotationYawPitchRollToRef = BJ_RotationYawPitchRollToRef;
    BABYLON.Quaternion.prototype.toEulerAngles = BJ_toEulerAngles;
    BABYLON.Quaternion.prototype.toRotationMatrix = BJ_toRotationMatrix;
    BABYLON.Matrix.prototype.toQuaternion = BJ_toQuaternion;
    
    model.computeWorldMatrix(true);
    camera._getViewMatrix();
});

$("#valueX").change(function () {
    model.rotation.x = $("#valueX").val();
    model.computeWorldMatrix(true);
});

$("#valueY").change(function () {
    model.rotation.y = $("#valueY").val();
    model.computeWorldMatrix(true);
});

$("#valueZ").change(function () {
    model.rotation.z = $("#valueZ").val();
    model.computeWorldMatrix(true);
});





//////////////////////////////////////////////
// BabylonJS and EuclideanSpace conversions //
//////////////////////////////////////////////

var BJ_RotationYawPitchRollToRef = BABYLON.Quaternion.RotationYawPitchRollToRef;
var BJ_toEulerAngles = BABYLON.Quaternion.prototype.toEulerAngles;
var BJ_toRotationMatrix = BABYLON.Quaternion.prototype.toRotationMatrix;
var BJ_toQuaternion = undefined;

// from http://www.euclideanspace.com/maths/geometry/rotations/conversions/eulerToQuaternion/index.htm
var ES_RotationYawPitchRollToRef = function (yaw, pitch, roll, result) {
    var halfYaw = yaw * 0.5;
    var halfRoll = -roll * 0.5;
    var halfPitch = pitch * 0.5;
    
    var cosYaw = Math.cos(halfYaw);
    var sinYaw = Math.sin(halfYaw);
    var cosRoll = Math.cos(halfRoll);
   ...