With DateTimeFormatterBuilder, one could do `.toFo...
# kotlinx-datetime
s
With DateTimeFormatterBuilder, one could do
.toFormatter(locale)
to get the right localization options for things like months. With a
LocalDateTime.Format
what is the equivalent? Is it to create separate formatters and pick the right one manually by comparing our
locale
object? Smth like
Copy code
when(locale.toString()) {
  "..." -> monthDateAndTimeEn
  "..." -> monthDateAndTimeSe
}
Where each formatter will do this manually, like
monthName(MonthNames.ENGLISH_ABBREVIATED)
,
monthName(MonthNames.SWEDISH_ABBREVIATED)
(where
MonthNames.SWEDISH_ABBREVIATED
would be a custom thing of course) etc? Am I missing something obvious here? The formatter itself does not look to take in a locale in some other way
e
there's no multiplatform locale support in the Kotlin ecosystem
so there's no multiplatform locale-aware formatting either
s
Ah yeah, makes sense, thanks for the link too. So for me to be able to move forward for now, is my idea of separate formatters that you chose from manually from your current locale my best bet, or would you suggest something else?
e
use the platforms' specific formatters instead of kotlinx-datetime if you need locale, since locale is platform specific anyway
💡 1
gratitude thank you 1
s
I just wanted to stop dealing with the weird world of java date time formatters and how you specify what you want using those strings that I always need to re-learn every time I touch them. And I saw the way kotlinx does it and I wanted to try it out for clarity reasons. I suppose I should just give up this idea then, until this is implemented, whenever that may be.