Update formatters to latest

Ensure renovate can bump them by specifying full coordinates in toml.
This commit is contained in:
Jake Wharton
2024-01-29 12:02:30 -05:00
committed by Zac Sweers
parent 84ca5cfd7e
commit 2cc9ebb88e
15 changed files with 155 additions and 90 deletions

View File

@@ -81,19 +81,40 @@ internal fun String.parseIsoDate(): Date {
var offset = 0
// extract year
val year = parseInt(this, offset, 4.let { offset += it; offset })
val year = parseInt(
this,
offset,
4.let {
offset += it
offset
},
)
if (checkOffset(this, offset, '-')) {
offset += 1
}
// extract month
val month = parseInt(this, offset, 2.let { offset += it; offset })
val month = parseInt(
this,
offset,
2.let {
offset += it
offset
},
)
if (checkOffset(this, offset, '-')) {
offset += 1
}
// extract day
val day = parseInt(this, offset, 2.let { offset += it; offset })
val day = parseInt(
this,
offset,
2.let {
offset += it
offset
},
)
// default time value
var hour = 0
var minutes = 0
@@ -108,11 +129,28 @@ internal fun String.parseIsoDate(): Date {
}
if (hasT) {
// extract hours, minutes, seconds and milliseconds
hour = parseInt(this, 1.let { offset += it; offset }, 2.let { offset += it; offset })
hour = parseInt(
this,
1.let {
offset += it
offset
},
2.let {
offset += it
offset
},
)
if (checkOffset(this, offset, ':')) {
offset += 1
}
minutes = parseInt(this, offset, 2.let { offset += it; offset })
minutes = parseInt(
this,
offset,
2.let {
offset += it
offset
},
)
if (checkOffset(this, offset, ':')) {
offset += 1
}
@@ -120,7 +158,14 @@ internal fun String.parseIsoDate(): Date {
if (this.length > offset) {
val c = this[offset]
if (c != 'Z' && c != '+' && c != '-') {
seconds = parseInt(this, offset, 2.let { offset += it; offset })
seconds = parseInt(
this,
offset,
2.let {
offset += it
offset
},
)
if (seconds in 60..62) seconds = 59 // truncate up to 3 leap seconds
// milliseconds can be optional in the format
if (checkOffset(this, offset, '.')) {