Skip to content

Commit 2b91a0f

Browse files
committed
fix: show current date on consent signature
1 parent d625ae5 commit 2b91a0f

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/components/exhibition-consent/SignatureSection.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,22 @@ function formatSignatureDate(value?: string | null) {
2525
return `${year}.${month}.${day}`;
2626
}
2727

28+
function formatTodayDate() {
29+
const date = new Date();
30+
const year = date.getFullYear();
31+
const month = String(date.getMonth() + 1).padStart(2, "0");
32+
const day = String(date.getDate()).padStart(2, "0");
33+
return `${year}.${month}.${day}`;
34+
}
35+
2836
export default function SignatureSection({
2937
mode,
3038
signatureDataUrl,
3139
signedAt,
3240
onSignatureChange,
3341
}: SignatureSectionProps) {
3442
const isReadOnly = mode === "readonly";
35-
const displayDate = formatSignatureDate(signedAt);
43+
const displayDate = isReadOnly ? formatSignatureDate(signedAt) : formatTodayDate();
3644
const displaySignatureUrl = normalizeImageUrl(signatureDataUrl);
3745

3846
const handleClear = () => {

0 commit comments

Comments
 (0)