-
-
Notifications
You must be signed in to change notification settings - Fork 148
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(calendar): fix bug with empty date #744
Conversation
seflue
commented
Jun 4, 2024
- simplify state by replacing month with date and month method
- handle rendering correctly when changing month
- work around a bug in date (will be fixed later)
@kristijanhusak @chipsenkbeil I discovered a bug in I would appreciate if we could review and merge this quickly, because the bug is currently on master. Now that I have tests (and actually an idea, how to test the widget) I will continue to improve the calendar with further PRs. I might also fix the problem in |
@seflue what is the actual bug you're solving? |
It is an edge case with the end of month, which leads to unexpected nil date, which breaks the widget. It is in the date class, but easily to work around. |
The fix of the actual cause is a bit more complicated - I will make a second PR soon. |
I don't remember why I had both |
Gave a scan over where date is used (only in one file, IIRC) within org roam. I only access |
That's what I actually did. The month member function is now deriving the month from the date state. Actually I had a hard time thinking over this, when I wrote my first implementation of the time picker - and already tried to get rid of month as an independent state, which was not easy with the original implementation. But with the refactoring of calendar it got reintroduce - meanwhile I had mostly forgotten, what I initially did. When I discovered and investigated the bugs, the deja vus came on after another ... With this fix it should now be much more stable. |
8126ee2
to
1fb0243
Compare
I rebased the code onto master and removed the quickfix. Now the essence of this PR is the removal of the |
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.
Looks good, just some minor changes.
Also please rebase from master. I found a bug with the calendar not being able to go to previous/next year because the month number overflows, and days_of
was not able to find the correct number of days.
f919c29
to
80755ae
Compare
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.
Works great! Just few minor things and it's good to go.
5a2e6bd
to
05e95f2
Compare
- simplify state by replacing month with date - handle rendering correctly when changing month
@kristijanhusak I don't know, why the tests fail, it is unrelated to the code and it doesn't fail, when I run the tests locally. But unfortunately I don't have permissions to rerun the tests. |
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.
I can reproduce the test fail on master branch with nightly, so it's unrelated to this. Everything looks good now, merging. Thanks!
- simplify state by replacing month with date - handle rendering correctly when changing month Co-authored-by: Sebastian Flügge <seflue@users.noreply.github.com>