yannickl / YLMoment

Parsing, validating, manipulating, and formatting dates easily in Objective-C (API inspired by moment.js)

Home Page:http://yannickl.github.io/YLMoment

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Locale Seeming Can't Be Changed Multiple Times

sxross opened this issue · comments

I'm writing a RubyMotion wrapper for this Cocoapod and it seems that the only way to set the locale is to set it on the class-level proxy member. I can do this successfully, but subsequent attempts to change that locale have no effect.

Questions:

  • Is accessing the proxy member the right way to go?
  • Why would the second attempt fail?

Consider the scenario of tests where the I test first en_US, then fr_FR, etc.

Thanks

Hi,

The proxy works like the UIAppearance protocol for views; it allows you to configure the moments in a global way. So yes this is the right way if you want configure all of them. However you can change the locale for each NSMoment object independently, it should works too.

I don't know why it fails, that's not a normal behavior, I'll check that this w-e (I can't now).

Thank you for the report.

Right. My code was changing the class-level proxy locale and I wanted to be changing the instance level locale. My code was faulty, not yours.