1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-17 00:07:37 +02:00
Files
jc/docs/parsers/date.md

90 lines
1.4 KiB
Markdown
Raw Normal View History

2020-07-31 14:39:02 -07:00
# jc.parsers.date
jc - JSON CLI output utility date Parser
Usage:
specify --date as the first argument if the piped input is coming from date
Compatibility:
'linux', 'darwin', 'freebsd'
Examples:
$ date | jc --date -p
{
"year": 2020,
"month": "Jul",
"day": 31,
"weekday": "Fri",
"hour": 14,
"minute": 35,
"second": 55,
"timezone": "PDT"
}
$ date | jc --date -p -r
{
"year": "2020",
"month": "Jul",
"day": "31",
"weekday": "Fri",
"hour": "14",
"minute": "36",
"second": "14",
"timezone": "PDT"
}
## info
```python
info()
```
## process
```python
process(proc_data)
```
Final processing to conform to the schema.
Parameters:
proc_data: (dictionary) raw structured data to process
Returns:
2020-07-31 14:47:06 -07:00
Dictionary. Structured data with the following schema:
2020-07-31 14:39:02 -07:00
{
"year": integer,
"month": string,
"day": integer,
"weekday": string,
"hour": integer,
"minute": integer,
"second": integer,
"timezone": string
}
## parse
```python
parse(data, raw=False, quiet=False)
```
Main text parsing function
Parameters:
data: (string) text data to parse
raw: (boolean) output preprocessed JSON if True
quiet: (boolean) suppress warning messages if True
Returns:
2020-07-31 14:47:06 -07:00
Dictionary. Raw or processed structured data.
2020-07-31 14:39:02 -07:00