createSortByDateFn
Creates a sort function for objects by date property.
Available since v1.9.0
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
property | keyof T | The property to sort by (defaults to 'date'). Accepted value types: Date (including cross-realm instances), string, or number (Unix milliseconds). Any object with a getTime(): number method is also accepted (duck-typed, so cross-realm Date objects work correctly). null, undefined, and unparseable strings produce NaN and sort last, distinct from a genuine Unix-epoch date (new Date(0)). (optional) |
Returns
Section titled “Returns”SortFn<T> — Sort function
Examples
Section titled “Examples”createSortByDateFn
Section titled “createSortByDateFn”Related Types
Section titled “Related Types”SortFn
Section titled “SortFn”Sort function type for arrays
