WhoopInc / frozen-moment-OLD

NOW A MOMENT PLUGIN:
https://github.com/WhoopInc/frozen-moment
MIT License
9 stars 0 forks source link

s/lang/locale #9

Closed butterflyhug closed 10 years ago

butterflyhug commented 10 years ago

Port the forward-looking locale API from moment#1761 to FrozenMoment, without the backward compatibility hacks. Add additional fixes so that all the core locale switching tests pass (although the tests for individual translations are still seriously broken, due to the mutation API differences between Moment and FrozenMoment).

Not sure how I like the combined moment.locale() getter/setter for setting global state -- it feels pretty inconsistent with the rest of FrozenMoment. But then, this is the only place that we support any type of global configuration statefulness, so it really is a special situation. It's also nice that this design maintains a close correspondence to the upstream API.

These API changes are a (partial?) answer to the API design question in #2.

butterflyhug commented 10 years ago

I need to update our documentation for this.

butterflyhug commented 10 years ago

Upon further reflection, the entire notion of having global state that's changeable at runtime seems like a very poor fit for a library where immutability is the primary selling point. I'll be merging this now, but more API changes are coming soon.