-
-
Notifications
You must be signed in to change notification settings - Fork 984
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
Error while parsing cyrillic month names on Linux and OS X #273
Comments
I was able to reproduce the issue in Windows as well. What I found out is when you convert January to Russian, you get the word "января" instead of "Январь". In other words, if you change your code to the line below, it will work: DateTimeFormat.forPattern("MMMM").withLocale(new Locale.Builder().setLanguage("ru").setScript("Cyrl").build()).parseDateTime("января"); These words, as you know better than me, have different cases. The library returns you the genitive case, but you are expecting the nominative case. Update: |
In russian language if date has a day using genitive case (2 января 2015) if only month using nominative case (январь 2015) update: |
Oops, yes, you are right - the genitive case. Date january = new Date(2015, 0, 1);
Locale dLocale = new Locale.Builder().setLanguage("ru").setScript("Cyrl").build();
SimpleDateFormat formatWithDay = new SimpleDateFormat("dd MMMM", dLocale);
SimpleDateFormat formatWithoutDay = new SimpleDateFormat("MMMM", dLocale);
System.out.println("With day: " + formatWithDay.format(january));
System.out.println("Without day: " + formatWithoutDay.format(january)); It gives me two different names:
Hm... somehow Java decides a correct word. Let me check how. |
@jodastephen, do you know if this issue can be a bug, or afterwards this is just how Java 8 behaves and we have to live with it? |
If JDK 8 has the data, then Joda-Time could be adapted to use it. But it would have to be by reflection, and it would be a fair bit of work. In general, I don't add new features to Joda-Time now that |
Works fine on all systems
Throw exception on OS X
Using OS X 10.10 and Linux Ubuntu 14.04, Oracle JDK/JRE 1.8, joda-time 2.7
The text was updated successfully, but these errors were encountered: