sort by date in typescript example Example: sort array by date typescript array.sort((x, y) => +new Date(x.createdAt) - +new Date(y.createdAt));