Skip to content

Commit

Permalink
Update Customise parent locale
Browse files Browse the repository at this point in the history
This adds the description of defining a locale with a parent that hasn't itself been defined or loaded yet which has been available since 2.16.0. This adds the additional behavior when creating a moment of lazy loading the parent locale if it isn't already loaded, or defaulting to the global locale if the parent doesn't exist. See PR (moment/moment#4310) As the next version number isn't determined yet, this should be merged only with the next release that includes the above PR.
  • Loading branch information
cmyers committed Jan 6, 2018
1 parent 8492869 commit 4038147
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/moment/07-customization/00-intro.md
Expand Up @@ -31,6 +31,14 @@ moment.defineLocale('en-foo', {
```
Properties that are not specified in the locale will be inherited from the parent locale.

As of **2.16.0** it is possible to define a locale with a parent that hasn't itself been defined or loaded.

```javascript
moment.defineLocale('fakeLocale', {parentLocale:'xyz'})
```

As of **next moment version** when attempting to create a moment with the newly defined locale, moment will attempt to lazy load the parent if it exists. Failing that it will default the parent to the global locale.

As of **2.12.0** it is also possible to update a locale's properties.

```javascript
Expand Down

0 comments on commit 4038147

Please sign in to comment.