UdeS moment element wrapper for Moment.js

[ 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>

Install

Link to this version
ImportedReleased 10 September 2018MIT License
Framework Support
Polymer 2.0+
Browser Compatibility
Install with
bower install --save UdeSElements/udes-moment"#2.2.1"
Run the above Bower command in your project folder. If you have any issues installing, please contact the author.
Release notes - Version 2.2.1

Dependencies

  • moment#moment/moment#^2.0.0
  • polymer#Polymer/polymer#^2.0.0
  • udes-language-mixin#UdeSElements/udes-language-mixin#^2.0.0