1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-10-08 23:22:21 +02:00

fix weekday numbering to be ISO 8601 compliant. Add naive calculated epoch timestamp field

This commit is contained in:
Kelly Brazil
2021-03-22 20:56:57 -07:00
parent 0a4de2d3a1
commit 1565019966
5 changed files with 85 additions and 63 deletions

View File

@@ -2,6 +2,8 @@
# jc.parsers.date
jc - JSON CLI output utility `date` command output parser
Calculated epoch time field is naive (i.e. based on the local time of the system the parser is run on) since there is no unambiguous timezone information in the `date` command output.
Usage (cli):
$ date | jc --date
@@ -23,28 +25,30 @@ Examples:
$ date | jc --date -p
{
"year": 2020,
"month_num": 7,
"day": 31,
"hour": 16,
"minute": 48,
"second": 11,
"year": 2021,
"month_num": 3,
"day": 22,
"hour": 20,
"minute": 47,
"second": 3,
"period": null,
"month": "Jul",
"weekday": "Fri",
"weekday_num": 6,
"timezone": "PDT"
"month": "Mar",
"weekday": "Mon",
"weekday_num": 1,
"timezone": "PDT",
"epoch": 1616471223
}
$ date | jc --date -p -r
{
"year": "2020",
"month": "Jul",
"day": "31",
"weekday": "Fri",
"hour": "16",
"minute": "50",
"second": "01",
"year": "2021",
"month": "Mar",
"day": "22",
"weekday": "Mon",
"hour": "20",
"minute": "48",
"second": "12",
"timezone": "PDT"
}
@@ -81,7 +85,8 @@ Returns:
"month": string,
"weekday": string,
"weekday_num": integer,
"timezone": string
"timezone": string,
"epoch": integer
}