connect-moment-i18n

Creates a localized moment instance for connect/express

connect-moment-i18n

Creates a localized moment instance for connect/express

npm install connect-moment-i18n

Initialize the middleware with:

var express = require('express'),
    connectMomentI18n = require('connect-moment-i18n'),
    app = express();
 
app.use(connectMomentI18n());

By default, the middleware creates a localized moment instance set to the language locale specified at req.locale and attaches it to req.moment. You may pass an options hash, described below, to the constructor in order to alter the middleware's behavior.

Specifies the key on the request object the locale can be found. Defaults to locale.

Specifies the key on the request object at which the localized moment will be attached. Defaults to moment.