Skip to content

Commit

Permalink
Uppercase offset option for WireMock to work around a library bug
Browse files Browse the repository at this point in the history
  • Loading branch information
irfano committed Nov 25, 2024
1 parent bf58aee commit 72c41bb
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ internal class UnlocalizedDateHelper : HandlebarsHelper<Any?>() {
val localeCode: String? = options.hash("locale", "en_US_POSIX")
var date = Date()
if (offset != null) {
date = DateOffset(offset).shift(date)
// Uppercase the unit using the invariant locale as a workaround for a bug in DateOffset
val fixedOffset = offset.split(" ").let { strings ->
"${strings[0]} ${strings[1].uppercase()}"
}
date = DateOffset(fixedOffset).shift(date)
}
var locale: Locale = Locale.getDefault()
if (localeCode != null) {
Expand Down

0 comments on commit 72c41bb

Please sign in to comment.