How to use Moment.js in a UI Builder Client Script Include?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2025 03:55 AM
I have seen a few posts on using moment.js (library) in UI Scripts - but I am using UI Builder with Client Script Includes ("sys_ux_client_script_include").
Is there a way I can embed the moment library and return a moment instance, so instead of (Node style)
import moment from 'moment-timezone'
...I can use?
const { getMomentTZ } = imports['MyMomentUtils']();
const moment = getMomentTZ();
I am hoping there is a way to do this with moment.js code loaded into the Client Script Include however it maybe possible to consider loading this dynamically from server hosted js file e.g. this StackOverflow potential solution.
0 REPLIES 0