HOw to order number in dataview

Things I have tried

What I’m trying to do

Screen Shot 2022-11-10 at 13.47.52

How to sort this according to number order? not alphabetical order

You don’t provide any detail as to what your existing code looks like, but here’s the sort function:

yourColumn.sort((a, b) => { 
  return [0, 1]
    .map(i => parseInt(a.split('-')[i]) - parseInt(b.split('-')[i]))
    .reduce((p, c) => p === 0 ? c : p )
})

Input:

1115-1206H
1347-1421H
661-728H
672-723H

Output:

661-728H
672-723H
1115-1206H
1347-1421H

where should I put them?

this is my current code

```dataview
TABLE WITHOUT ID
 file.link as People,
 dates as "Masa",
 peran,
 wilayah

FROM #islam/people and -"YYY Extras"

SORT dates asc

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.