Fixed sorting by date #1412

This commit is contained in:
Mike Farah
2022-11-04 12:21:12 +11:00
parent 7f5dda93c6
commit cf02b90624
11 changed files with 114 additions and 25 deletions
+8
View File
@@ -54,6 +54,14 @@ var sortByOperatorScenarios = []expressionScenario{
"D0, P[], (!!seq)::[{a: 1}, {a: 10}, {a: 100}]\n",
},
},
{
description: "Sort by custom date field",
document: `[{a: "12-Jun-2011"},{a: "23-Dec-2010"},{a: "10-Aug-2011"}]`,
expression: `with_dtf("02-Jan-2006"; sort_by(.a))`,
expected: []string{
"D0, P[], (!!seq)::[{a: \"23-Dec-2010\"}, {a: \"12-Jun-2011\"}, {a: \"10-Aug-2011\"}]\n",
},
},
{
skipDoc: true,
document: "[{a: 1.1},{a: 1.001},{a: 1.01}]",