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

Inconsistencies in jaq date formatting in versions 1.3 and 1.6 #214

Closed
bedilbek opened this issue Sep 24, 2024 · 2 comments
Closed

Inconsistencies in jaq date formatting in versions 1.3 and 1.6 #214

bedilbek opened this issue Sep 24, 2024 · 2 comments

Comments

@bedilbek
Copy link

bedilbek commented Sep 24, 2024

jaq --version
jaq -nc '"2024-05-15T15:38:00.200Z" | fromdate | todate'
jaq -nc '"2024-05-15T15:38:00.000Z" | fromdate | todate'

image

image

@bedilbek
Copy link
Author

I would rather backport those date formatting as it was in version 1.3.0. Because I believe that formatting was more consistent and deterministic

@01mf02
Copy link
Owner

01mf02 commented Sep 25, 2024

Hi @bedilbek, you're right, the jaq 1.6 behaviour does not seem to be very consistent.
This was due to a bug; I thought that for a floating-point number f, f / 1e6 is equivalent to f * 1e-6; it turns out that the former (division) preserves more precision than the latter (multiplication).
I also fixed the precision of todate to always print 6 decimal places if the input is a floating-point number. This should also contribute to making the formatting more consistent.
Again, thanks for spotting and reporting this!

@01mf02 01mf02 closed this as completed Sep 25, 2024
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

No branches or pull requests

2 participants