• Formats a Date into "relative date". For example, a date that is today would be formatted as "Today".

    Example

    formatAsRelativeDate(new Date(2020, 10, 21), new Date(2020, 10, 21)) // Today
    formatAsRelativeDate(new Date(2020, 10, 20), new Date(2020, 10, 21)) // Yesterday
    formatAsRelativeDate(new Date(2020, 10, 19), new Date(2020, 10, 21)) // October 19

    Returns

    The formatted string.

    Parameters

    • date: Date

      The date.

    • baseDate: Date

      The date from which to calculate the relative formatting.

    Returns string

Generated using TypeDoc