Skip to content

Conversation

@angelamayxie
Copy link
Contributor

@angelamayxie angelamayxie commented Jan 30, 2026

fixes dolthub/dolt#10390

Previous calculation incorrectly assumed every year has 365 days (doesn't account for leap years) and month has 30 days (doesn't account for over half the months). The offset from this wasn't noticeable with smaller time differences but became apparent with larger time differences. This still needs to be fixed for month and quarter (#10393)

@angelamayxie angelamayxie changed the title Recalculate year for timestampdiff based on year, date, and clock time values Calculate year for timestampdiff based on date and clock time values Jan 30, 2026
@angelamayxie angelamayxie requested a review from jycor January 30, 2026 23:05
@angelamayxie angelamayxie marked this pull request as ready for review January 30, 2026 23:05
Copy link
Contributor

@jycor jycor left a comment

Choose a reason for hiding this comment

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

LGTM, maybe just fix month and quarter too? I'm fine if it's in a separate PR.

@angelamayxie angelamayxie merged commit b0e4117 into main Jan 30, 2026
8 checks passed
@angelamayxie angelamayxie deleted the angela/yeardiff branch January 30, 2026 23:25
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.

TIMESTAMPDIFF produces incorrect results for year units

3 participants