Number in German format in dashboard (100.235,25) - how to?

for future reference:
You have to first install 'intl' with npm according to the nodered manual (https://nodered.org/docs/user-guide/writing-functions#loading-additional-modules) so that you can use it in nodered functions.
You have to npm install intl from the same directory as your settings.js file and add it to the function global context in the settings.js file like this:

functionGlobalContext: {
        intl:require('intl')
    },

and afterwards restart nodered.
When this is done you can use it like this in a function node:

var intl = global.get('intl');
let a = msg.payload;
let b = intl.NumberFormat('de-De',{style:'decimal'}).format(a);
msg.payload = b;
return msg;

The input has to be of type number.
maybe just use regex otherwise :see_no_evil:
Best regards Johannes

1 Like