MiSawa / xq

Pure rust implementation of jq
MIT License
318 stars 18 forks source link

strftime / strflocaltime / todateiso8601 / todate after strptime does not work #97

Closed itchyny closed 2 years ago

itchyny commented 2 years ago

jq supports using strftime/strflocaltime/todateiso8601/todate against the output of strptime.

❯ jq 'strptime("%F %T") | strftime("%Y %m %d %H %M %S")' <<< '"2022-03-01 12:10:20"'
"2022 03 01 12 10 20"

❯ jq 'strptime("%F %T") | todateiso8601' <<< '"2022-03-01 12:10:20"'
"2022-03-01T12:10:20Z"

❯ xq 'strptime("%F %T") | strftime("%Y %m %d %H %M %S")' <<< '"2022-03-01 12:10:20"'
Error: InvalidArgType("strftime", [2022, 2, 1, 12, 10, 20, 2, 59])

❯ xq 'strptime("%F %T") | todateiso8601' <<< '"2022-03-01 12:10:20"'
Error: InvalidArgType("strftime", [2022, 2, 1, 12, 10, 20, 2, 59])

❯ xq --version
xq 0.2.10-ad33a92d252fc4842f10730973e16f5da8434035