-
Notifications
You must be signed in to change notification settings - Fork 7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement locale inheritance and locale updating #2774
Conversation
Looks good to me. |
Merged in 78bfe90 |
Implement locale inheritance and locale updating
when I m using moment.js in my simple html page getting "Deprecation warning: use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale " how can I fixed it ..? |
@Aditya28268 if you are updating an existing locale, just use .updateLocale instead of .locale |
Hello , I'm not using ".locale" in my code or not updating any existing locale . On Thursday 23 June 2016 10:42 PM, Maggie Pint wrote:
Warm Regards, Aditya Singh Tomar |
Hi Aditya, two quick things: 1. please don't post issues at the bottom of other issues; it creates a hassle for us and makes it harder for people who care about the issue here to find out what they want. 2. You might have better luck posting on SO or chatting with us on Gitter. The warning you're seeing isn't something that we expect to see, so it's not really possible for us to help without knowing more about what you've done, and getting to the bottom of it in Github tickets is a painful way to do that. |
I am using the moment.updateLocale function and I keep getting the following error: Property |
But it's so troublesome. |
You mean about this warning at console? |
i dont know set define & update local for persian! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add to the system
Users have requested this in one way or another.
Locale inheritance
Now, you can write
which would create a new locale
en-foo
, taking as base theen
locale and modifying the specified properties. Providing an object field (like calendar) will update only the supplied fields, the rest will be inherited. (for exampe specifyingcalendar: {sameDay: '...'}
, will updatesameDay
, but keepnextDay
and the other calendar attributes).Locale update
This has similar semantics to inheritance, but changes the specified locale, instead of creating a new one. Actually the original locale is not changed but a new one with the same name created. This means existing moments using the updated locale won't change behavior.
Use
To revert an update. If there are no applied updates this removes the locale.
TODO: