@welshare/sdk
    Preparing search index...

    Function formatDate

    • Format a date string or timestamp to a human-readable format.

      Parameters

      • dateInput: string | number | Date

        ISO date string, timestamp (number), or Date object

      • options: FormatDateOptions = {}

        Formatting options

      Returns string

      Formatted date string, or the original input if parsing fails

      formatDate("2024-01-15T10:30:00Z");
      // "January 15, 2024 at 10:30 AM"

      formatDate("2024-01-15T10:30:00Z", { month: "short" });
      // "Jan 15, 2024 at 10:30 AM"

      formatDate("2024-01-15T10:30:00Z", { includeTime: false });
      // "January 15, 2024"

      formatDate(1705312200000);
      // "January 15, 2024 at 10:30 AM"