Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

timezone conversion options #21

Open
prashanth-hegde opened this issue Dec 24, 2021 · 0 comments
Open

timezone conversion options #21

prashanth-hegde opened this issue Dec 24, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@prashanth-hegde
Copy link
Owner

Problem description
When the json document has a different timezone, I need it converted into a timezone that I specify

Proposed solution
Provide a -z|--zone fieldName=Timezone option for conversion
Support epoch and ISO8601 timestamps

Use Cases

  1. For displaying ISO8601 timestamps with specific timezones

Additional context
Example:
Say for the response

curl "https://randomuser.me/api/?results=10" | jpath 'results[dob.age > 40].{name.first, name.last, dob.date}' -t


|           DATE           |   FIRST    |   LAST   |
|--------------------------|------------|----------|
| 1967-02-07T15:26:12.239Z | Dragica    | Klingler |
| 1951-09-07T14:30:19.950Z | Quinn      | Thomas   |

The timezone is specified in UTC.

If I then specify the -z option,

curl "https://randomuser.me/api/?results=10" | jpath 'results[dob.age > 40].{name.first, name.last, dob.date}' -t -z date=America/Chicago


|           DATE                           |   FIRST    |   LAST   |
|------------------------------------------|------------|----------|
| 1967-02-07T10:26:12.239[America/Chicago] | Dragica    | Klingler |
| 1951-09-07T09:30:19.950[America/Chicago] | Quinn      | Thomas   |
@prashanth-hegde prashanth-hegde added the enhancement New feature or request label Dec 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant