How to dynamically require momentjs locale
You can just use a .locale()
function after parsing correct language from request (but you have send a language header at least)
const moment = require('moment');const language = getLanguageFromRequest(req); // or whatever logic you likemoment.locale(language);
but maybe it is better idea to handle it in browser, not in a backend.