toLocateString does not work



  • I'm using the JavaScript method "toLocateString" on a jsReport helper function to format prices, but it doesn't work:

    function formatPrice(x){
    return x.toLocaleString('it-IT');
    }

    Can anyone help me?



  • I am afraid node.js doesn't ship with full internationalization support by default.

    I would recommend to use a third-party library that will do the job for you.

    Or if you use chrome-pdf, one option is also to do the localization task through page javascript. However the previous option is probably better.

    <div id='a'>a</div>
    <script>
        document.getElementById('a').innerHTML = 
        new Date().toLocaleString('ko-KR')
    </script> 
    

Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.