You could use sort_by/1
on the fields, you’ll have to either normalize the date/time formats or conditionally parse them out using strptime/1
. It returns an array of the date fields in significant order combine to a single array and sort_by will do the rest.
.data.monitor
| sort_by([
(.Date | strptime("%A %d %B %Y")),
(.Time | split(" ")[0] | if contains(":") then
strptime("%I:%M%p")
else
strptime("%I%p")
end)
])