I am trying to use toLocaleString()
in a Pug view. It works when no arguments are provided. It seems to default to 'en-US'
, irrespective of the browser (language) used. I can live with that, but I would like to use the options, such that 2 decimals are displayed, i.e., as follows:
toLocaleString('en-US', { minimumIntegerDigits: 2 })
In the JavaScript section of the Pug view that works fine. I have also tried using toFixed(2).toLocaleString()
, but then it seems like toLocaleString()
is ignored.
FYI I am trying to do this in a table, full line of code:
td(align="right")= record.cy.toLocaleString('en-US', { minimumIntegerDigits: 2 })
where record.cy
is a Number
.