I wanted to use moment in a function node. I stumbled upon this issue which appears rather old.
I tried using the tip to add the moments to the functionGlobalContext but did not work. I did not get the error during NR startup that it does not find moments, but global.get("moment") did not return anything.
Now, I am using the function-npm node where I can use require and it works:
var moment = require('moment'); msg.payload = moment().format('MMMM Do YYYY, h:mm:ss a'); // April 27th 2020, 6:08:20 pm return msg;
Is this still the recommended method, or did I missed some other and supported option?