Skip to content

Commit 6ca896e

Browse files
authored
Merge branch 'master' into renovate/vertxversion
2 parents 1f1d375 + 00b1961 commit 6ca896e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/main/kotlin/spp/protocol/artifact/metrics/MetricStep.kt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,17 @@ enum class MetricStep {
7070
}
7171
return Instant.from(formatter.parse(value))
7272
}
73+
74+
companion object {
75+
fun fromBucketFormat(value: String): MetricStep {
76+
return values().firstOrNull {
77+
try {
78+
it.bucketFormatter.parse(value)
79+
true
80+
} catch (ignore: Exception) {
81+
false
82+
}
83+
} ?: throw IllegalArgumentException("Invalid date time format: $value")
84+
}
85+
}
7386
}

0 commit comments

Comments
 (0)