YLMoment icon indicating copy to clipboard operation
YLMoment copied to clipboard

Swift: YLMoment(dateAsString: <#String!#>, format: <#String!#>) defaults to non-english even though locale is English

Open deanq opened this issue 11 years ago • 4 comments

This only occurs when it's less than a minute. It looks like "a few seconds ago" and "n seconds" is localized by a different value (dutch or swedish?). I'm not sure what language that is.

deanq avatar Sep 17 '14 22:09 deanq

Can you give me more detail on your project configuration? It happens with Xcode 6, iOS 8? Have you another localized files (may be from another project) with the same keys?

I'll not be available this w-e, but I'll check that later.

yannickl avatar Sep 19 '14 19:09 yannickl

Sorry. Xcode 6 latest, any iOS simulator (7.1 and 8.0). No localization yet. Also, dateAsString doesn't work when I have a different timezone like "2014-09-19T13:00:00-0700" but if I use UTC, then it works.

deanq avatar Sep 19 '14 20:09 deanq

Sorry for the late, but after many tests with Xcode 6.0.1 and 6.1 and for iOS 7 or over I noticed no issue. Have you some project tests or code sample to reproduce the problem?

yannickl avatar Oct 21 '14 15:10 yannickl

I got the same error with swift. Or something with iOS 8.1 simulator, or XCode 6. Even if the current locale is en_US bundle is dutch. Here is the code:

let moment = YLMoment(dateAsString: 2014-12-29T18:36:58.242Z, format: "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")            
println(moment.fromNow())`

It prints vor 18 Stunden. When I set the moment.locale it works ok.

osrl avatar Dec 30 '14 11:12 osrl