I’m working on a Zapier automation and need to use the Moment.js library for date manipulation. According to Zapier’s documentation, Moment.js should be available by default in their Code by Zapier actions.
When I try to import the library using:
const moment = require('moment');
I get this error message:
Error: Cannot find module 'moment'
If I don’t import it and just try to use moment directly, I get a reference error saying moment is not defined.
Has anyone successfully used Moment.js in Zapier? Am I missing something in the setup or is there a different way to access the library?
Hit this exact issue during a migration with dozens of Zapier workflows using moment. The docs are trash - they list libraries that don’t even exist anymore. Instead of rewriting everything with native Date methods, I just copied the moment functions I actually needed straight into the Code by Zapier action. Grab the formatting or parsing logic from moment’s source and drop it in as helper functions. Not pretty, but it kept our existing logic intact without learning new APIs or gambling on what Zapier supports next month. Takes up more space in your code blocks but kills the dependency headache.
Yeah, hit this same issue last month - super annoying. Zapier quietly dropped moment but didn’t bother updating their docs. Switched to dayjs instead - const dayjs = require('dayjs') works great and the syntax is basically identical to moment if you already know it.
Zapier’s runtime limitations are exactly why I ditched it for date stuff. You’re stuck with whatever libraries they support, and they’ll drop them without warning.
I hit this problem constantly at work - platform dependencies that break when they change their minds. The fix? Build on something you control.
I do all my date processing through Latenode now. You can use any JavaScript library you want, including full Moment.js if that’s what your code needs. No more guessing what’s available or dealing with outdated docs.
Set up a simple workflow that takes your date input, processes it with whatever logic you need using actual Moment.js, then sends the result wherever Zapier was going to send it. Takes 10 minutes to build and you’re done worrying about surprise runtime changes.
Way more reliable than rewriting code every time a platform switches libraries.
Had this exact issue on a client project last year. The docs are misleading - they make it seem like moment still works when it doesn’t. I ended up using Intl.DateTimeFormat with regular Date operations instead. Handles timezones and localization without any external libraries. For stuff like adding months or weeks, I just wrote simple utility functions that work with Date objects directly. Easy to pick up if you know JavaScript already. Actually runs faster than moment did, plus you won’t get burned when Zapier drops support again. Hit up the JavaScript Date reference on MDN - it covers pretty much everything you’d normally use moment for.
ugh this burned me too couple weeks back. zapier’s runtime changes are so annoying. ended up just doing new Date().toLocaleDateString() and basic math for date stuff. works fine for simple formatting and adding/subtracting days without importing anything extra.
Hit this same issue six months ago and wasted hours debugging my code. Super frustrating because Zapier’s docs still mention Moment.js, but they’ve actually removed it from their runtime. I switched to native JavaScript Date methods with some custom helpers. For basic stuff like formatting, adding days, or parsing ISO strings, the built-in Date object does everything you need. If you’re doing complex timezone work or need fancy formatting, try Luxon - it plays better with Zapier’s current setup. Once you get the hang of native methods, it’s not bad. Just different syntax.
Zapier dropped Moment.js support in Code by Zapier actions a while back. Their docs are still outdated in some spots, which is confusing. Use JavaScript’s built-in Date object or date-fns instead - both work fine in Zapier’s environment. For basic stuff, native methods like new Date(), toISOString(), and getTime() handle most cases. Need something more complex? Import date-fns with const { format, addDays } = require('date-fns') - works without any issues. I made this same switch after hitting the error and it’s way more reliable than fighting with Moment.js.