mirror of
https://github.com/mikefarah/yq.git
synced 2026-09-06 02:03:24 +08:00
Fixed sorting by date #1412
This commit is contained in:
@@ -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}]",
|
||||
|
||||
Reference in New Issue
Block a user