# ember-cli-moment-shim

> Brings moment and moment-timezone into your Ember applications

Latest version **3.8.0** (published 2020-05-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install ember-cli-moment-shim
pnpm add ember-cli-moment-shim
yarn add ember-cli-moment-shim
bun add ember-cli-moment-shim
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.8.0 |
| Published | 2020-05-11 |
| First published | 2015-07-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | 6.* \|\| 8.* \|\| >= 10.* |
| Dependencies | 11 |
| Unpacked size | 12.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 33 |
| Author | Jason Mitchell |
| Maintainers | jasonmit, kellyselden |
| Keywords | ember-addon, ember-moment, moment, momentjs |

## Links

- npm: https://www.npmjs.com/package/ember-cli-moment-shim
- Repository: https://github.com/jasonmit/ember-cli-moment-shim
- Issues: https://github.com/jasonmit/ember-cli-moment-shim/issues
- npm.io page: https://npm.io/package/ember-cli-moment-shim

## Dependencies (11)

- [chalk](https://npm.io/package/chalk.md) ^1.1.3
- [moment](https://npm.io/package/moment.md) ^2.19.3
- [broccoli-stew](https://npm.io/package/broccoli-stew.md) ^1.5.0
- [broccoli-funnel](https://npm.io/package/broccoli-funnel.md) ^2.0.0
- [broccoli-source](https://npm.io/package/broccoli-source.md) ^1.1.0
- [ember-cli-babel](https://npm.io/package/ember-cli-babel.md) ^7.1.2
- [lodash.defaults](https://npm.io/package/lodash.defaults.md) ^4.2.0
- [moment-timezone](https://npm.io/package/moment-timezone.md) ^0.5.13
- [ember-get-config](https://npm.io/package/ember-get-config.md)
- [broccoli-merge-trees](https://npm.io/package/broccoli-merge-trees.md) ^2.0.0
- [ember-cli-import-polyfill](https://npm.io/package/ember-cli-import-polyfill.md) ^0.2.0

## Recent versions

- 3.8.0 (latest) — 2020-05-11
- 3.7.1 — 2018-04-18
- 3.7.0 — 2018-04-17
- 3.6.0 — 2018-03-13
- 3.5.3 — 2018-03-07
- 3.5.2 — 2018-03-07
- 3.5.1 — 2018-03-06
- 3.5.0 — 2017-09-06
- 3.4.0 — 2017-08-02
- 3.3.3 — 2017-06-27
- 3.3.2 — 2017-06-27
- 3.3.1 — 2017-06-01
- 3.3.0 — 2017-05-23
- 3.2.0 — 2017-05-23
- 3.1.0 — 2017-04-05
- … 25 more at https://npm.io/package/ember-cli-moment-shim/versions

## README

# ember-cli-moment-shim
[![Build Status](https://travis-ci.org/jasonmit/ember-cli-moment-shim.svg?branch=master)](https://travis-ci.org/jasonmit/ember-cli-moment-shim)
[![npm Version][npm-badge]][npm]
[![Ember Observer Score](http://emberobserver.com/badges/ember-cli-moment-shim.svg)](http://emberobserver.com/addons/ember-cli-moment-shim)

ember-cli ES6 module shim for [momentjs](https://momentjs.com) and [moment timezone](https://momentjs.com/timezone/) within your Ember applications.  It will also conditionally bundle in specific locale/timezone data for those concerned about payload size.

## Usage

* `ember install ember-cli-moment-shim`

```js
import moment from 'moment';
```

## Features

* ES6 accessible module for moment
* Trim your build sizes by bundling locale & timezone data through simple configuration
* FastBoot support

## Enabling moment-timezone

```js
// config.environment.js
module.exports = function(environment) {
  return {
    moment: {
      // Options:
      // 'all' - all years, all timezones
      // 'subset' - subset of the timezone data to cover 2010-2020 (or 2012-2022 as of 0.5.12). all timezones.
      // 'none' - no data, just timezone API
      includeTimezone: 'all'
    }
  };
}
```

## i18n support

### Cherry pick locales (optimal)

```js
// config.environment.js
module.exports = function(environment) {
  return {
    moment: {
      // To cherry-pick specific locale support into your application.
      // Full list of locales: https://github.com/moment/moment/tree/master/locale
      includeLocales: ['es', 'fr-ca']
    }
  };
```

*NOTE: English is bundled automatically – no need to add `en` in `includeLocales`*

### Include all locales

```js
// config.environment.js
module.exports = function(environment) {
  return {
    moment: {
      includeLocales: true
    }
  };
```

### Configure default runtime locale

```js
// app/routes/applicaton.js
import moment from 'moment';

export default Ember.Route.extend({
  beforeModel() {
    // sets the application locale to Spanish
    moment.locale('es');
  }
});
```

### Write all locales to a folder that is relative to `dist`

```js
// config.environment.js
module.exports = function(environment) {
  return {
    moment: {
      // This will output _all_ locale scripts to assets/moment-locales
      // this option does not respect includeLocales
      localeOutputPath: 'assets/moment-locales'
    }
  };
```

The feature set for i18n support within moment can be found here:  http://momentjs.com/docs/#/i18n/

## License

ember-cli-moment-shim shims is [MIT Licensed](https://github.com/jasonmit/ember-cli-moment-shim/blob/master/LICENSE.md).

[npm]: https://www.npmjs.org/package/ember-cli-moment-shim
[npm-badge]: https://img.shields.io/npm/v/ember-cli-moment-shim.svg?style=flat-square

---
_Source: https://npm.io/package/ember-cli-moment-shim · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
