Skip to content

Commit 15cf428

Browse files
committed
Make swift/bic uppercase always
Format currency exchange in Norwegian locale
1 parent 82fb5b5 commit 15cf428

2 files changed

Lines changed: 20 additions & 11 deletions

File tree

src/components/BankDetailsForm.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,10 @@ export function BankDetailsForm({
226226
<Input
227227
{...field}
228228
placeholder={t("expense.bankSwiftBicPlaceholder")}
229+
onChange={(event) => {
230+
const value = event.target.value.toUpperCase()
231+
field.onChange(value)
232+
}}
229233
onBlur={() => {
230234
field.onBlur()
231235
const cleaned = (field.value || "")

src/lib/pdf.ts

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -372,17 +372,17 @@ export async function generatePDF({
372372
exchange: "Valuta / kurs",
373373
amount: "Beløp (NOK)",
374374
}
375-
;(
376-
Object.keys(rebalancedColumns) as Array<keyof typeof rebalancedColumns>
377-
).forEach((key) => {
378-
coverPage.drawText(headerTexts[key], {
379-
x: rebalancedColumns[key].x,
380-
y: headerTextY,
381-
size: 11,
382-
font,
383-
color: jzDark,
375+
; (
376+
Object.keys(rebalancedColumns) as Array<keyof typeof rebalancedColumns>
377+
).forEach((key) => {
378+
coverPage.drawText(headerTexts[key], {
379+
x: rebalancedColumns[key].x,
380+
y: headerTextY,
381+
size: 11,
382+
font,
383+
color: jzDark,
384+
})
384385
})
385-
})
386386

387387
const dataFontSize = 10
388388
const dataLineHeight = 12
@@ -423,7 +423,12 @@ export async function generatePDF({
423423
const exchangeRate = await getExchangeRate(expense.currency, expenseDate)
424424
const base = `${formatCurrency(expense.amount)} ${expense.currency}`
425425
exchangeText =
426-
exchangeRate !== null ? `${base} @ ${exchangeRate.toFixed(4)}` : base
426+
exchangeRate !== null
427+
? `${base} @ ${formatCurrency(exchangeRate, "nb-NO", {
428+
minimumFractionDigits: 4,
429+
maximumFractionDigits: 4,
430+
})}`
431+
: base
427432
}
428433

429434
const descriptionLines = wrapToWidth(

0 commit comments

Comments
 (0)