Skip to content

Free & Open-Source Invoice Generator - No Sign-Up, No Ads, Instant PDF Export, 100% In-Browser, and Fully Customizable Templates.

fix: enhance invoice PDF filename formatting and update translations for consistency

VladSez406203efdd9e
diff --git a/src/app/components/invoice-pdf-download-link.tsx b/src/app/components/invoice-pdf-download-link.tsx
index 2fb979b..0d745d9 100644
--- a/src/app/components/invoice-pdf-download-link.tsx
+++ b/src/app/components/invoice-pdf-download-link.tsx
@@ -15,6 +15,7 @@ import { toast } from "sonner";
import { umamiTrackEvent } from "@/lib/umami-analytics-track-event";
import { ErrorGeneratingPdfToast } from "@/components/ui/toasts/error-generating-pdf-toast";
import * as Sentry from "@sentry/nextjs";
+import dayjs from "dayjs";
const DONATION_TOAST_CONFIG = {
title: "❤️ Enjoying EasyInvoicePDF? Help Keep It Free!",
@@ -57,10 +58,15 @@ export function InvoicePDFDownloadLink({
const filename = useMemo(() => {
const invoiceNumberValue = invoiceData?.invoiceNumberObject?.value;
- const name = `invoice-${invoiceData.language}-${invoiceNumberValue}.pdf`;
+ // Replace all slashes with dashes (e.g. 01/2025 -> 01-2025)
+ const formattedInvoiceNumber = invoiceNumberValue
+ ? invoiceNumberValue?.replace(/\//g, "-")
+ : dayjs().format("MM-YYYY"); // Fallback to current month and year if no invoice number
+
+ const name = `invoice-${invoiceData?.language?.toUpperCase()}-${formattedInvoiceNumber}.pdf`;
return name;
- }, [invoiceData.language, invoiceData.invoiceNumberObject]);
+ }, [invoiceData?.language, invoiceData?.invoiceNumberObject]);
const PdfDocument = useMemo(
() => <InvoicePdfTemplate invoiceData={invoiceData} />,
diff --git a/src/app/constants/index.ts b/src/app/constants/index.ts
index deda29d..c367b7c 100644
--- a/src/app/constants/index.ts
+++ b/src/app/constants/index.ts
@@ -93,7 +93,7 @@ export const INITIAL_INVOICE_DATA = {
nameFieldIsVisible: true,
typeOfGTU: "",
- typeOfGTUFieldIsVisible: false,
+ typeOfGTUFieldIsVisible: false, // we hide this field by default because it's not always needed
amount: 1,
amountFieldIsVisible: true,
diff --git a/src/app/schema/translations.ts b/src/app/schema/translations.ts
index 6f833b5..d72c5db 100644
--- a/src/app/schema/translations.ts
+++ b/src/app/schema/translations.ts
@@ -272,7 +272,7 @@ export const TRANSLATIONS = {
invoiceItemsTable: {
no: "N°",
nameOfGoodsService: "Descripción del producto/servicio",
- typeOfGTU: "Tipo GTU",
+ typeOfGTU: "Tipo\n GTU",
amount: "Cantidad",
unit: "Unidad",
netPrice: "Precio neto",
@@ -323,7 +323,7 @@ export const TRANSLATIONS = {
invoiceItemsTable: {
no: "N°",
nameOfGoodsService: "Descrição do produto/serviço",
- typeOfGTU: "Tipo GTU",
+ typeOfGTU: "Tipo\n GTU",
amount: "Quantidade",
unit: "Unidade",
netPrice: "Preço\n líquido",
@@ -374,7 +374,7 @@ export const TRANSLATIONS = {
invoiceItemsTable: {
no: "№",
nameOfGoodsService: "Наименование товара/услуги",
- typeOfGTU: "Тип GTU",
+ typeOfGTU: "Тип\n GTU",
amount: "Количество",
unit: "Ед.\n изм.",
netPrice: "Цена без НДС",
@@ -425,7 +425,7 @@ export const TRANSLATIONS = {
invoiceItemsTable: {
no: "№",
nameOfGoodsService: "Найменування товару/послуги",
- typeOfGTU: "Тип GTU",
+ typeOfGTU: "Тип\n GTU",
amount: "Кількість",
unit: "Од.\n вим.",
netPrice: "Ціна без ПДВ",
@@ -476,7 +476,7 @@ export const TRANSLATIONS = {
invoiceItemsTable: {
no: "N°",
nameOfGoodsService: "Désignation du produit/service",
- typeOfGTU: "Type GTU",
+ typeOfGTU: "Type\n GTU",
amount: "Quantité",
unit: "Unité",
netPrice: "Prix HT",
@@ -527,7 +527,7 @@ export const TRANSLATIONS = {
invoiceItemsTable: {
no: "N°",
nameOfGoodsService: "Descrizione del prodotto/servizio",
- typeOfGTU: "Tipo GTU",
+ typeOfGTU: "Tipo\n GTU",
amount: "Quantità",
unit: "Unità",
netPrice: "Prezzo netto",