Server-side - how to use momentjs?

I’m trying to use momentjs on server-side and I’m getting an error “TypeError: moment is not a function”. It works fine on client-side.

Sample code:

import { Meteor } from 'meteor/meteor';
import { TaskCollection } from '/imports/db/taskCollection';
import moment from "moment";

Meteor.publish('tasks', function publishTasks(date) {
  console.log(moment().format());
  return TaskCollection.find({ userId: this.userId,  date});
});

Does it need to be imported in a different way on server-side?
Lodash works fine on server-side but moment doesn’t.

import { Meteor } from 'meteor/meteor';
import { TaskCollection } from '/imports/db/taskCollection';
import _ from 'lodash';

Meteor.publish('tasks', function publishTasks(date) {
  console.log(_.last([1]));
  return TaskCollection.find({ userId: this.userId,  date});
});

Hi there,

before using Moment you may want to read this:
https://momentjs.com/docs/#/-project-status/

Server side you might want to use something like this: dateformat - npm or Node native Date functions

Hi, thanks, didn’t know moment was dead. I’ll use something different then