convnum
    Preparing search index...

    Function compareDateFormatOrder

    • Compare two date format strings for sorting purposes.

      Parameters

      • formatA: string

        The first date format string to compare

      • formatB: string

        The second date format string to compare

      Returns number

      A negative value if formatA is before formatB, a positive value if formatA is after formatB, or 0 if they are the same

      dateFormats.sort((a, b) => compareDateFormatOrder(a, b))
      

      Priority order:

      1. Y-M-D variations (replacing "-" with ".", ",", "/", ", ", " ", etc.)
      2. D-M-Y variations
      3. M-D-Y variations
      4. Y-M variations
      5. M-Y variations
      6. M-D variations
      7. D-M variations
      8. Named month formats (by pattern similarity)

      Within each category, formats are sorted by separator:

      1. -
      2. .
      3. /
      4. ,
      5. ,

      then by format specificity (M2/D2 before M1/D1)