jvmMain.io.islandtime.format.TimeZoneTextProvider.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of core-metadata Show documentation
Show all versions of core-metadata Show documentation
A multiplatform library for working with dates and times
The newest version!
package io.islandtime.format
import io.islandtime.TimeZone
import java.util.*
actual object PlatformTimeZoneTextProvider : TimeZoneTextProvider {
override fun timeZoneTextFor(zone: TimeZone, style: TimeZoneTextStyle, locale: Locale): String? {
return if (zone is TimeZone.FixedOffset || !zone.isValid || style.isGeneric()) {
null
} else {
val javaTzStyle = if (style.isShort()) java.util.TimeZone.SHORT else java.util.TimeZone.LONG
val isDaylightSaving = style.isDaylightSaving()
return java.util.TimeZone.getTimeZone(zone.id).getDisplayName(isDaylightSaving, javaTzStyle, locale)
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy