From c3143fbe60156f0d95d7d8c9c19f93a7ac2bca15 Mon Sep 17 00:00:00 2001 From: Vikrant Kumar Date: Wed, 2 Sep 2026 13:02:28 +0530 Subject: [PATCH] Raise the ordinal suffix in the certificate preview The preview showed 4th Year on the baseline while the PDF now sets the suffix as a superscript, so the two no longer matched. The preview splits the ordinal the same way and renders the suffix in a sup element; anything that is not a plain ordinal is passed through untouched. --- .../Certificates/BonafideCertificate.jsx | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/Modules/Certificates/BonafideCertificate.jsx b/src/Modules/Certificates/BonafideCertificate.jsx index b3bb5a56c..081518331 100644 --- a/src/Modules/Certificates/BonafideCertificate.jsx +++ b/src/Modules/Certificates/BonafideCertificate.jsx @@ -62,6 +62,18 @@ const filenameFrom = (header, fallback) => { return match?.[1] || fallback; }; +// Renders an ordinal such as "4th" with the suffix raised, as the PDF does. +function ordinalWithSuperscript(value) { + const match = /^(\d+)(st|nd|rd|th)$/.exec((value ?? "").trim()); + if (!match) return value; + return ( + <> + {match[1]} + {match[2]} + + ); +} + export default function BonafideCertificate() { const [rollNumber, setRollNumber] = useState(""); const [selectedStudent, setSelectedStudent] = useState(null); @@ -326,9 +338,11 @@ export default function BonafideCertificate() { {preview.student.relation}{" "} MR. {preview.student.father_name} is a student of{" "} - {preview.student.year_ordinal} Year ( - {preview.student.semester_ordinal} Semester){" "} - {preview.student.programme} in{" "} + + {ordinalWithSuperscript(preview.student.year_ordinal)} Year + {" "} + ({ordinalWithSuperscript(preview.student.semester_ordinal)}{" "} + Semester) {preview.student.programme} in{" "} {preview.student.discipline} ({" "} {preview.student.duration_text} course duration:{" "} {preview.student.start_year} to{" "}