Don't fail on events with no dtend#5
Merged
jonathanballs merged 1 commit intojonathanballs:mainfrom May 2, 2025
Merged
Conversation
Owner
|
Hi @madjar, Thanks for the PR - that's a good catch. I suggest throwing something like this at the bottom of describe "time zone resolution" do
test "gracefully handles nil start or end times" do
{:ok,
%Magical.Calendar{
events: [
%Magical.Event{
dtstart: ~D[2018-01-01],
dtend: nil
}
]
}} =
"""
BEGIN:VCALENDAR
BEGIN:VEVENT
DTSTART;VALUE=DATE:20180101
END:VEVENT
END:VCALENDAR
"""
|> Parser.parse()
end
end |
Owner
|
I noticed that you have found a couple of extra edge cases that you mentionned in the other PR. I will review them shortly. |
Contributor
Author
|
Updated with the test! I tweak the one you provided a bit, since the test ics needs to have a timezone to enable that code path. I also went with a datetime to exercise the conversion behaviour. |
Owner
|
Merged - thank you for your contribution! I will wait until the other PR for alarms is merged before pushing a new hex release 👍 |
Contributor
Author
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I ran the parser on my google calendar export (after the fixes from #2), and I noticed that I have events with a
DTSTARTand noDTEND, which the parser doesn't like. This PR ensures that we can resolve thenildtend tonil:)I couldn't find place where a test would fit, but I'm happy to add one if you point me in the right direction.