offset Is Negative
True if the offset is negative.
Samples
import kotlinx.datetime.*
import kotlinx.datetime.format.*
import kotlin.test.*
fun main() {
//sampleStart
// Formatting and parsing a UTC offset in complex scenarios
val format = DateTimeComponents.Format { offset(UtcOffset.Formats.ISO) }
val formattedOffset = format.format {
setOffset(UtcOffset(-3, -30, -15))
check(offsetHours == 3)
check(offsetMinutesOfHour == 30)
check(offsetSecondsOfMinute == 15)
check(offsetIsNegative == true)
}
check(formattedOffset == "-03:30:15")
val parsedOffset = format.parse("-03:30:15")
check(parsedOffset.toUtcOffset() == UtcOffset(-3, -30, -15))
check(parsedOffset.offsetHours == 3)
check(parsedOffset.offsetMinutesOfHour == 30)
check(parsedOffset.offsetSecondsOfMinute == 15)
check(parsedOffset.offsetIsNegative == true)
//sampleEnd
}