Skip to content

Commit

Permalink
Don't want leading zeros on long dates.
Browse files Browse the repository at this point in the history
  • Loading branch information
qtips authored and Kevin Sillerud committed Jan 4, 2021
1 parent fc24996 commit 5d5bad6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/main/kotlin/no/nav/pdfgen/Bootstrap.kt
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ val objectMapper: ObjectMapper = ObjectMapper()
.registerKotlinModule()
val base64encoder: Encoder = Base64.getEncoder()
val dateFormat: DateTimeFormatter = DateTimeFormatter.ofPattern("dd.MM.yyyy")
val dateFormatLong: DateTimeFormatter = DateTimeFormatter.ofPattern("dd. MMMM yyyy")
val dateFormatLong: DateTimeFormatter = DateTimeFormatter.ofPattern("d. MMMM yyyy")
.withLocale(Locale("no", "NO"))
val datetimeFormat: DateTimeFormatter = DateTimeFormatter.ofPattern("dd.MM.yyyy HH:mm")
val templateRoot: Path = Paths.get("templates/")
Expand Down
6 changes: 3 additions & 3 deletions src/test/kotlin/no/nav/pdfgen/HelperSpek.kt
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ object HelperSpek : Spek({
val context = jsonContext(jsonNodeFactory.objectNode().apply {
put("timestamp", "2020-03-03T10:15:30")
put("timestampLong", "2020-10-03T10:15:30")
put("date", "2020-02-01")
put("date", "2020-02-12")
})

it("should format as Norwegian short date and time") {
Expand All @@ -144,11 +144,11 @@ object HelperSpek : Spek({
}

it("should format timestamp as Norwegian long date") {
handlebars.compileInline("{{ iso_to_long_date timestampLong }}").apply(context) shouldEqual "03. oktober 2020"
handlebars.compileInline("{{ iso_to_long_date timestampLong }}").apply(context) shouldEqual "3. oktober 2020"
}

it("should format date as Norwegian long date") {
handlebars.compileInline("{{ iso_to_long_date date }}").apply(context) shouldEqual "01. februar 2020"
handlebars.compileInline("{{ iso_to_long_date date }}").apply(context) shouldEqual "12. februar 2020"
}
}

Expand Down

0 comments on commit 5d5bad6

Please sign in to comment.