cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Use moment.js in services

lala_guliyeva
11-Garnet

Use moment.js in services

Hello,

 

I see moment.js library in libraries list of ThingWorx.

 

I try to use it:

const currentDate = moment();

But in this case service returns error:

"moment" is not defined

 What can be a problem?

 

Thank you in advance.

ACCEPTED SOLUTION

Accepted Solutions

Where you are using moment.js on a UI Extension or at Server Side Javascript? on the first case you should be able to use it, on the second not, there isn't moment.js (nor anyother) on Server Side Javascript (this is not the browser it's the Rhino Javascript engine).

View solution in original post

3 REPLIES 3

Where you are using moment.js on a UI Extension or at Server Side Javascript? on the first case you should be able to use it, on the second not, there isn't moment.js (nor anyother) on Server Side Javascript (this is not the browser it's the Rhino Javascript engine).

yes, I tried to use it at server side.

 

it's strange, that we have at server side dateFormat, but don't have momentjs.

Then at server side, yes you only have the dateFormat. You can't add moment.js.

Announcements


Top Tags