dhm

dustjs-helpers-moment

Helpers Moment.js for dustjs-linkedin package

Showing:

Popularity

Downloads/wk

11

GitHub Stars

0

Maintenance

Last Commit

5yrs ago

Contributors

0

Package

Dependencies

1

Size (min+gzip)

56.6KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

dustjs-helpers-moment

Helpers Moment.js for dustjs-linkedin package

KrakenJS Logo

#Install dependence

npm install dustjs-helpers-moment --save

On ./config/config.json find this code

"view engines": {
    "js": {
      "module": "engine-munger",
      "renderer": {
        "method": "js",
        "arguments": [
          { "cache": true },
          {
            "views": "config:express.views",
            "view engine": "config:express.view engine",
            "specialization": "config:specialization",
            "i18n": "config:i18n"
          }
        ]
      }
    }
  },

Replace with:

"view engines": {
    "js": {
      "module": "engine-munger",
      "renderer": {
        "method": "js",
        "arguments": [
          { "cache": true, "helpers": ["dustjs-helpers-moment"] },
          {
            "views": "config:express.views",
            "view engine": "config:express.view engine",
            "specialization": "config:specialization",
            "i18n": "config:i18n"
          }
        ]
      }
    }
  },

type: (optional)

  • format (Default)
  • fromNow
  • subtract
  • add

date: (optional)

  • new Date() (Default)

format: (optional)

  • MMM Do YYYY (Default)

input: (optional)

  • 1 (Default)

value (optional)

  • days (Default)

locale: (optional)

  • en (Default)

format

<span>
    {@moment type="format" date="{youreDate}" format="YYYY. MMMM Do HH:mm" locale="es"/}
</span>

fromNow

<span>
    {@moment type="fromNow" date="{youreDate}" locale="es"/}
</span>

subtract

<span>
    {@moment type="subtract" date="{youreDate}" input="10" value="days" locale="es"/}
</span>

add

<span>
    {@moment type="add" date="{youreDate}" input="10" value="days" locale="es"/}
</span>

Complete documentation for methods, inputs, values and locales http://momentjs.com/.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100