-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Fix timestamp_add_interval_months to pass any date #6815
Conversation
Signed-off-by: jayzhan211 <jayzhan211@gmail.com>
@@ -579,8 +579,8 @@ async fn timestamp_add_interval_months() -> Result<()> { | |||
let t1_naive = chrono::NaiveDateTime::parse_from_str(res1, format).unwrap(); | |||
let t2_naive = chrono::NaiveDateTime::parse_from_str(res2, format).unwrap(); | |||
|
|||
let year = t1_naive.year() + (t1_naive.month() as i32 + 17) / 12; | |||
let month = (t1_naive.month() + 17) % 12; | |||
let year = t1_naive.year() + (t1_naive.month0() as i32 + 17) / 12; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of using NOW()
we could use some table of dates instead to test it?.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would avoid the test breaking suddenly on a certain date.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Dandandan It seems your suggestion is great, it failed today again :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approve to get the main branch passing. Left a comment to improve the test
* fix Signed-off-by: jayzhan211 <jayzhan211@gmail.com> * use month0 Signed-off-by: jayzhan211 <jayzhan211@gmail.com> --------- Signed-off-by: jayzhan211 <jayzhan211@gmail.com>
Which issue does this PR close?
Closes #6814.
Rationale for this change
What changes are included in this PR?
Are these changes tested?
Are there any user-facing changes?