Skip to content

Commit

Permalink
Update Customise parent locale (#485)
Browse files Browse the repository at this point in the history
* Update Customise parent locale

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.

* Update 00-intro.md
  • Loading branch information
cmyers authored and marwahaha committed Mar 2, 2018
1 parent 6a5ea88 commit 9fba96f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/moment/07-customization/00-intro.md
Original file line number Diff line number Diff line change
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 **2.21.0** 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 9fba96f

Please sign in to comment.