ChemPal Documentation - v0.0.13-beta.5
    Preparing search index...

    Function formatTimestamp

    • Format a Unix epoch timestamp (in milliseconds) as a short, locale-aware "month day, hour:minute" string for UI surfaces like the history and excluded-products lists in the settings drawer. Shared so both panels render the same shape without drifting over time.

      Parameters

      • epochMs: number

        Timestamp in milliseconds since the Unix epoch.

      Returns string

      A locale-formatted string such as "Mar 26, 2:15 PM".

      formatTimestamp(1711468500000);
      // => "Mar 26, 2:15 PM" (en-US locale)
      export function formatTimestamp(epochMs: number): string {
      return new Date(epochMs).toLocaleString(undefined, {
      month: "short",
      day: "numeric",
      hour: "numeric",
      minute: "2-digit",
      });
      }