Directory

← Back

udes-moment

UdeS moment element wrapper for Moment.js

Author

Rating

Popularity

<100

[ This description is mirrored from README.md at github.com/UdeSElements/udes-moment on 2019-05-10 ]

<udes-moment>

Published on webcomponents.org

udes-moment is a Polymer 2 wrapper for the Moment.js library.

There are currently 2 components and 1 mixin available:

  • Components
    • <udes-moment>
    • <udes-moment-interval>
  • Mixin
    • UdeS.MomentMixin

The UdeS.MomentImportMixin is not intented to be use outside this repositery.

All the components and mixins use the UdeS.LanguageMixin to automatically update the date according to the global language.

What should I use?

You should use the UdeS.MomentMixin if you have many dates to format inside you component. If you have only one or two, use the components instead.

Configuration

If you use one of the components or one of the mixins, you need to update your polymer.json to includes the Moment.js files:

{
  "extraDependencies": [
    "bower_components/moment/min/moment.min.js",
    "bower_components/moment/locale/*.js"
  ],
}

You also need to update your sw-precache-config.js accordingly:

/* eslint-disable-next-line no-undef */
module.exports = {
  staticFileGlobs: [
    'bower_components/moment/locale/*',
    'bower_components/moment/min/moment.min.js',
  ],
};

Demo

<udes-moment-demo></udes-moment>

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

Dependencies

  • moment#moment/moment#^2.0.0
  • polymer#Polymer/polymer#^2.0.0
  • udes-language-mixin#UdeSElements/udes-language-mixin#^2.0.0
Released
2018-09-10
Maturity
IMPORTED
License
MIT License

Compatibility

Framework
Polymer 2.0+
Browser
Browser Independent

udes-moment - Vaadin Add-on Directory

UdeS moment element wrapper for Moment.js udes-moment - Vaadin Add-on Directory
**[ This description is mirrored from README.md at [github.com/UdeSElements/udes-moment](https://github.com//UdeSElements/udes-moment/blob/v2.2.0/README.md) on 2019-05-10 ]** # \ [![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](https://www.webcomponents.org/element/UdeSElements/udes-moment) `udes-moment` is a Polymer 2 wrapper for the [Moment.js](https://momentjs.com/) library. There are currently **2** components and **1** mixin available: - Components - \ - \ - Mixin - UdeS.MomentMixin The `UdeS.MomentImportMixin` is not intented to be use outside this repositery. All the components and mixins use the `UdeS.LanguageMixin` to automatically update the date according to the global language. ## What should I use? You should use the `UdeS.MomentMixin` if you have many dates to format inside you component. If you have only one or two, use the components instead. ## Configuration If you use one of the components or one of the mixins, you need to update your `polymer.json` to includes the Moment.js files: ```json { "extraDependencies": [ "bower_components/moment/min/moment.min.js", "bower_components/moment/locale/*.js" ], } ``` You also need to update your `sw-precache-config.js` accordingly: ```javascript /* eslint-disable-next-line no-undef */ module.exports = { staticFileGlobs: [ 'bower_components/moment/locale/*', 'bower_components/moment/min/moment.min.js', ], }; ``` ## Demo ```html ```
Online