joda-time icon indicating copy to clipboard operation
joda-time copied to clipboard

Consider adding support for standalone day of week/month pattern symbols

Open dlew opened this issue 10 years ago • 6 comments

In Android they added support for two non-standard symbols:

  • c - standalone day of week
  • L - standalone month

I was wondering if it's reasonable to add these to joda-time itself. I can work on a pull request, but I wanted to check before putting any time into it - would it be alright to add, or should we avoid these specializations?

(This was inspired by https://github.com/dlew/joda-time-android/issues/30)

dlew avatar Feb 10 '15 02:02 dlew

There is no problem with adding additional pattern letters to Joda-Time via a PR. However, the bigger question is what data to output? The data for standalone is not available in earlier JDK versions.

jodastephen avatar Feb 10 '15 15:02 jodastephen

Based on Android's SimpleDateFormat examples, it seems like they are identical to the non-standalone versions. Though maybe that's in English only?

dlew avatar Feb 10 '15 15:02 dlew

Different languages will have different data. Could default to a simple solution, but in Joda-Time it should really use reflection to access whatever data is available on Java 8.

jodastephen avatar Feb 12 '15 12:02 jodastephen

Hello! In continuation of the topic, take a look at the fixed bug in JDK. They have introduced standalone style for month names 'L' and made 'M' pattern context dependent. So, now it's possible again in JDK to get month name in subjective case. Unfortunately, I didn't find this ability in the latest version of joda (2.8.1), even on latest JDK 8 (1.8.0_51). Sadness :( So, I suppose jodastephen is right and joda should have different behaviour on JDK 8, at least. Or have compatible version.

Pavel-Nosov avatar Jul 21 '15 10:07 Pavel-Nosov

This issue makes it impossible to display month names correctly in some languages (e.g. finnish, slovakian) when using joda-time with JDK 8 or newer.

sasuw avatar Sep 08 '20 11:09 sasuw

If you want to raise a PR, let me know so we could agree what is needed first.

jodastephen avatar Sep 19 '20 18:09 jodastephen