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

loopdb: fix leapyear parsing #657

Merged
merged 1 commit into from
Oct 31, 2023

Conversation

sputn1ck
Copy link
Member

This PR fixes #655 by adding a check if a date would be in a leap year.

@sputn1ck sputn1ck requested a review from bhandras October 30, 2023 16:01
loopdb/sqlite.go Outdated Show resolved Hide resolved
@sputn1ck sputn1ck marked this pull request as ready for review October 31, 2023 12:13
@sputn1ck sputn1ck requested a review from bhandras October 31, 2023 12:13
Copy link
Member

@bhandras bhandras left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the fix 🥇

Copy link
Collaborator

@hieblmi hieblmi left a comment

Choose a reason for hiding this comment

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

Thanks for the fix! Got one Q.

loopdb/sqlite.go Outdated
"and month %v: %v", dateTimeStr, err)
}

if !isLeapYear(thisYear) && isLeapYear(year) &&
Copy link
Collaborator

Choose a reason for hiding this comment

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

couldn't we just replace this if thisYear is not a leap year?
if !isLeapYear(thisYear) && month == 2 && day == 29 {...

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah seems to work as well, thanks 👍

loopdb/sqlite.go Outdated Show resolved Hide resolved
loopdb/sqlite.go Outdated Show resolved Hide resolved
@sputn1ck sputn1ck requested a review from hieblmi October 31, 2023 16:09
Copy link
Collaborator

@hieblmi hieblmi left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@sputn1ck sputn1ck merged commit e093a0c into lightninglabs:master Oct 31, 2023
@sputn1ck sputn1ck deleted the fix_leapyear_bug branch October 31, 2023 16:46
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.

Failed to fix faulty timestamps
3 participants