Social data

Keep missing relationship dates explicitly unknown

If a relationship record lacks a usable timestamp, report an unknown date rather than substituting the current time or epoch. A fallback date can look authoritative while describing no actual event.

Worked example

Node.js example · save as example.mjs and run node example.mjs

function timestampLabel(seconds) {
  if (typeof seconds !== "number" || !Number.isFinite(seconds) || seconds <= 0)
    return "Unknown";
  const date = new Date(seconds * 1000);
  return Number.isNaN(date.getTime()) ? "Unknown" : date.toISOString();
}
console.log(timestampLabel(null));
console.log(timestampLabel(1700000000));

How it works

This standalone helper validates the field before conversion and rejects invalid Date results. Its positive-seconds rule is suitable for the illustrated modern relationship records, not a universal timestamp parser. The current checker likewise displays Unknown for absent timestamp values.

Limits and mistakes

Knowing a date does not establish the full relationship history. A missing field may reflect an unsupported schema or an incomplete row, so distinguish a genuinely unknown date from an importer bug that failed to extract available data.

Check the result

Expect Unknown and the corresponding 2023 UTC timestamp. Test null, undefined, nonnumeric text, and an out-of-range number to avoid displaying Invalid Date.

Sources

Reference documentation for the behavior used in this guide: