node-red-contrib-moment

raw JSON →
5.0.0 verified Sat Apr 25 auth: no javascript maintenance

Node-RED node for date/time formatting using Moment.js, with timezone, DST, and locale support. Current stable version is 5.0.0, requiring Node.js >=14.14 and Node-RED >=1.0. Provides two nodes: 'moment' for date/time formatting and 'humanizer' for duration descriptions. Locale-aware output strings. Note that moment.js is now built into JSONata, making this package less necessary; no further enhancements expected. Release cadence is irregular, with major versions introducing breaking dependency updates.

error Error: Cannot find module 'node-red-contrib-moment'
cause Package not installed or installed in wrong directory.
fix
Run 'npm install node-red-contrib-moment' from your Node-RED userDir (typically ~/.node-red).
error TypeError: moment is not a function
cause Attempting to use moment() directly from the package, which exports Node-RED nodes not a moment function.
fix
Do not require the package; use the node in your flows.
error Error: Module version mismatch. Expected 83, got 84.
cause Node.js version mismatch with native addon (though this package has none, but arises with native deps).
fix
Ensure Node.js version matches the one used during npm install. Try reinstalling: rm -rf node_modules && npm install.
breaking Node.js minimum version raised to v10 and Node-RED minimum to v1.0 in v4.0.0.
fix Upgrade Node.js to >=10 and Node-RED to >=1.0 before installing v4+.
deprecated Package is unlikely to receive further enhancements; moment.js is built into JSONata.
fix Consider using Node-RED's built-in JSONata moment functions in Change or Function nodes instead.
gotcha Moment.js treats months as zero-based (0 = January) when parsing object formats.
fix Always verify month values: January is 0, December is 11.
gotcha If msg.payload is not a valid date string or timestamp, the node may output 'Invalid date'.
fix Ensure input is a ISO 8601 string, Unix timestamp (milliseconds), or Date object.
npm install node-red-contrib-moment
yarn add node-red-contrib-moment
pnpm add node-red-contrib-moment

Installation and basic usage of the moment node in Node-RED: inject timestamp, configure format, output.

// No code import; install via Node-RED palette or run:
// cd ~/.node-red && npm install node-red-contrib-moment
// Then use the 'moment' node in your flows:
// 1. Inject a timestamp (or msg with a payload convertible to date)
// 2. Connect to moment node
// 3. Configure output format (e.g., "MMMM Do YYYY, h:mm:ss a")
// 4. Connect to debug node to see formatted string