Skip to content

Commit 7a4fafe

Browse files
Use Number.isFinite for profile.created_at gate (preserve created_at=0)
Address Copilot review on #39: the truthiness gate dropped a valid created_at of 0, while the modified computation uses Number.isFinite. Make them consistent.
1 parent 05952af commit 7a4fafe

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/diddoc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export function buildDidDocument(pubkey, { profile, follows, relays } = {}) {
5252
const p = {};
5353
for (const k of ['name', 'about', 'picture', 'website', 'nip05', 'lud16']) if (c[k]) p[k] = c[k];
5454
if (c.display_name && !p.name) p.name = c.display_name;
55-
if (profile.created_at) p.created_at = profile.created_at;
55+
if (Number.isFinite(profile.created_at)) p.created_at = profile.created_at;
5656
if (Object.keys(p).length) doc.profile = p;
5757
if (Array.isArray(c.alsoKnownAs) && c.alsoKnownAs.length) doc.alsoKnownAs = c.alsoKnownAs;
5858
} catch { /* malformed kind-0 content */ }

0 commit comments

Comments
 (0)