Skip to content

Commit

Permalink
Add a test.
Browse files Browse the repository at this point in the history
  • Loading branch information
hs-lsong committed May 30, 2024
1 parent e128797 commit 181ba21
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,4 +204,24 @@ public void itUsesDeprecationDateIfNoDateProvided() {
JinjavaInterpreter.popCurrent();
}
}

@Test
public void itUsesTimezoneFromConfigToFormatString() {
Jinjava jinjava = new Jinjava(
JinjavaConfig
.newBuilder()
.withTimeZone(ZoneOffset.ofHours(+2))
.withLocale(new Locale("da"))
.build()
);
JinjavaInterpreter interpreter = jinjava.newInterpreter();
JinjavaInterpreter.pushCurrent(interpreter);
try {
long timestamp = 1718920800000L; // 2024-06-20 22:00:00 UTC
assertThat(filter.filter(timestamp, interpreter, "%b %d, %Y, at %I:%M %p"))
.isEqualTo("jun. 21, 2024, at 12:00 AM");
} finally {
JinjavaInterpreter.popCurrent();
}
}
}

0 comments on commit 181ba21

Please sign in to comment.