How to use moment.js in Service Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2019 05:19 PM
I've read that there is moment.js out of the box in Service Portal. I located the dependency called moment-timezone-with-data-2010-2020-v0.5 and tried to use it like this in an object array:
start_date: moment(onbCase.getDisplayValue('hr_profile.employment_start_date')).format('MMM d, YYYY'),
However, I keep getting an error saying Server JavaScript error "moment" is not defined.
How exactly are you supposed to use the ootb moment.js dependency in Service Portal?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2019 05:35 PM
Please check below video which mentions steps to consume moment.js
https://www.youtube.com/watch?v=JrVGodtzY3U&feature=youtu.be
Regards,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2019 08:10 PM
Hey Sachin, that video didn't really help to show how to use it in Service Portal. Do you have any suggestions on how to load the dependency and use it in widget code?