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

feat: Add fromdateiso8601 and todateiso8601 #379

Merged

Conversation

yann-combarnous
Copy link
Contributor

@yann-combarnous yann-combarnous commented Nov 23, 2024

Support for built-in fromdateiso8601 and todateiso8601.

Based on PR #322, taking into account reviewer comments.

Fixes #321

@eiiches , FYI

Copy link
Owner

@eiiches eiiches left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for submitting a pull request. LGTM 👍

@eiiches eiiches merged commit b7954b4 into eiiches:develop/1.x Nov 25, 2024
1 check passed
@eiiches
Copy link
Owner

eiiches commented Nov 25, 2024

Oops, it seems that fromdateiso8601 shouldn't accept fractional seconds. This has to be fixed before publishing a stable release because the fix to disallow fractional seconds would be a breaking change. Are you willing to submit a fix? @yann-combarnous

$ jq-1.7.1 fromdateiso8601
"2024-11-25T14:13:48.123Z"
jq: error (at <stdin>:2): date "2024-11-25T14:13:48.123Z" does not match format "%Y-%m-%dT%H:%M:%SZ"

$ java -jar jackson-jq-cli-1.1.1-20241125.141032-1.jar  'fromdateiso8601'
"2024-11-25T14:13:48.123Z"
1732544028

@yann-combarnous
Copy link
Contributor Author

Oops, it seems that fromdateiso8601 shouldn't accept fractional seconds. This has to be fixed before publishing a stable release because the fix to disallow fractional seconds would be a breaking change. Are you willing to submit a fix? @yann-combarnous

$ jq-1.7.1 fromdateiso8601
"2024-11-25T14:13:48.123Z"
jq: error (at <stdin>:2): date "2024-11-25T14:13:48.123Z" does not match format "%Y-%m-%dT%H:%M:%SZ"

$ java -jar jackson-jq-cli-1.1.1-20241125.141032-1.jar  'fromdateiso8601'
"2024-11-25T14:13:48.123Z"
1732544028

Lack of handling for fractional seconds is raised as a bug, not feature request in JQ, see jqlang/jq#2224 .

So happy to reproduce the bug, if you want me to.

@yann-combarnous
Copy link
Contributor Author

Looks pretty simple to add: from the instant, call getNano and if the value is different than 0, throw exception.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for fromdateiso8601 and todateiso8601
2 participants