fix: remove label cut lines and zero-pad printed dates
Backend Image / build-and-push (push) Successful in 2m26s
Frontend Image / build-and-push (push) Successful in 1m56s

The dashed rectangle drawn around every label slot (a cut/crop line)
wasn't needed and is gone, along with the width/height params that
existed only to draw it. Dates on the label (bottling date, MHD) now
use { day: '2-digit', month: '2-digit' } so single-digit values print
with a leading zero (05.03.2026, not 5.3.2026) - the default 'numeric'
formatting was dropping it.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
Nick SzaunigandClaude Sonnet 5 committed 2026-09-05 16:44:25 +02:00
1 parent 1054a845ef
commit ac45514356
1 file changed
+9 -20
@@ -29,8 +29,15 @@ interface SheetLayout {
gapYMm: number; gapYMm: number;
} }
// '2-digit' forces a leading zero for day/month (e.g. "05.03.2026") - the
// default 'numeric' formatting drops it ("5.3.2026"), which is what the MHD
// on a printed label was showing.
function formatDate(date: Date): string { function formatDate(date: Date): string {
return date.toLocaleDateString('de-DE'); return date.toLocaleDateString('de-DE', {
day: '2-digit',
month: '2-digit',
year: 'numeric',
});
} }
// Prisma stores `elements` as a plain Json column; the shape is only ever // Prisma stores `elements` as a plain Json column; the shape is only ever
@@ -352,21 +359,11 @@ export class LabelTemplatesService {
elements, elements,
centerX - w / 2, centerX - w / 2,
centerY - h / 2, centerY - h / 2,
w,
h,
qrCodeBuffer, qrCodeBuffer,
); );
doc.restore(); doc.restore();
} else { } else {
this.drawLabel( this.drawLabel(doc, elements, originX, originY, qrCodeBuffer);
doc,
elements,
originX,
originY,
slotW,
slotH,
qrCodeBuffer,
);
} }
} }
@@ -379,16 +376,8 @@ export class LabelTemplatesService {
elements: LabelElement[], elements: LabelElement[],
originX: number, originX: number,
originY: number, originY: number,
widthPt: number,
heightPt: number,
qrCodeBuffer: Buffer | null, qrCodeBuffer: Buffer | null,
): void { ): void {
doc
.rect(originX, originY, widthPt, heightPt)
.dash(2, { space: 2 })
.stroke('#999999')
.undash();
for (const element of elements) { for (const element of elements) {
this.drawElement(doc, element, originX, originY, qrCodeBuffer); this.drawElement(doc, element, originX, originY, qrCodeBuffer);
} }