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

Rules differ #153

Closed
mountaineerbr opened this issue Jun 27, 2023 · 5 comments
Closed

Rules differ #153

mountaineerbr opened this issue Jun 27, 2023 · 5 comments

Comments

@mountaineerbr
Copy link

mountaineerbr commented Jun 27, 2023

The following input:

1988-01-30T00:00:01 1989-03-01T23:01:58

(may be UTC...)

Gives different results from my script:

Yours give:

1Y 1M *9W* 0D 23h 1m 57s	

(cmd: datediff -f'%Y %m %w %d %H %M %S')

While my datediff.sh script correctly gives the answer:

1Y 0M 4W 2D 23h 1m 57s

In that Y stands for years, M for months, W for weeks, D for days, h for hours, m for minutes, and s for seconds.

Isn't something weyrd?

@hroptatyr
Copy link
Owner

Hi, thanks for the report. You're right, looks like a bug.

@mountaineerbr
Copy link
Author

Hello, I found some more bugs related to C-code datediff in my testing logs.

Below are four errs. Results following sh means results from my datediff script and dd results are C-code datediff. Don't really know if these bugs are related to a single incomplete rule or more in C-code datediff.

1988-01-30T12:01:01+00:00 |  1989-03-02T00:58:58+00:00
sh=1Y 1M 0W 0D 12h 57m 57s
dd=1Y 1M 9W 0D 12h 57m 57s


1988-01-31T01:00:00+00:00 |  1989-03-01T23:01:58+00:00
sh=1Y 0M 4W 1D 22h 1m 58s
dd=1Y 1M 8W 6D 22h 1m 58s


1988-01-31T00:00:00+00:00 |  1989-03-01T00:00:01+00:00
sh=1Y 0M 4W 1D 0h 0m 1s
dd=1Y 1M 8W 6D 0h 0m 1s

1988-01-31T23:01:00+00:00 |  1988-03-01T23:58:00+00:00
sh=0Y 0M 4W 2D 0h 57m 0s
dd=0Y 1M 9W 0D 0h 57m 0s

I am not able to read C code well enough to understand all the component
systems nor follow the references.

May I ask if you wrote all the internal libs or have them imported from
some lower C libs? Thanks

hroptatyr added a commit that referenced this issue Jul 5, 2023
* bug/153:
  test, PEBKAC, result has 2 spaces
  fix, recheck for negative day difference after adding Feb days, fixes issue #153
  test, add regression case
@hroptatyr
Copy link
Owner

hroptatyr commented Jul 5, 2023

Hiya, they should all be fixed now. Stupid mistake on my side.
Thanks again for the report.

@mountaineerbr
Copy link
Author

OK, thanks anyways for never fully answering a question from myself about this weyrd calendrical calculations we have our paws on..

I admire anyone whoever has got mathematical skills, I have got none whatsoever but it was a good journey, anywho mate good bye I will cancel this issue, hopefully you guys have lots of people to talk about calendrical calculations in your nucleaus

@hroptatyr
Copy link
Owner

Oh what question was that then? It was indeed me who wrote all the internals, dateutils does not depend on libc (well it does for I/O)

GerHobbelt added a commit to GerHobbelt/dateutils that referenced this issue May 10, 2024
Summary: v0.4.11 of dateutils
Keywords: v0.4.11

This is dateutils v0.4.11.

This is a bugfix release.

Bugfixes:
- be strict about inputs in datetest --isvalid (hroptatyr#146)
- build on Macs again (hroptatyr#107)
- make illegible zone names fatal errors (hroptatyr#151)
- be strict in datetest --isvalid when inputs have been specified (hroptatyr#146)
- fix issue with negative days remaining after adding months in datediff (hroptatyr#153)

See info page examples and/or README.

# -----BEGIN PGP SIGNATURE-----
# Version: GnuPG v2
#
# iEYEABECAAYFAmWyMssACgkQlMmhrILJOQ4F0wCfbiWQfuERz79Mq+BNlyOw0tL6
# RkoAoItx9dPdr/1inKBukpq2McZK2QrF
# =upNa
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu Jan 25 11:07:07 2024 WEST
# gpg:                using DSA key 94C9A1AC82C9390E
# gpg: Can't check signature: No public key
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