Skip to content

Commit

Permalink
Issue 9 fix remove extra day on all day events
Browse files Browse the repository at this point in the history
  • Loading branch information
jbalcorn committed Oct 16, 2024
1 parent 7e2b688 commit 4703961
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ical2rem.pl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# version 0.8 2024-10-16
# - Issue 9. Remove extra day notation on all day events.
# version 0.7.1 2024-09-19
# - Made sure license statements were consistent
# version 0.7 2024-09-04
Expand Down Expand Up @@ -293,6 +295,11 @@ sub _process_todos {
$event->{'LEADTIME'} = $i;
}
}
# Issue 9. Multi-day events have extra day with zero time. Mark this as the date not needed in reminders file so we can skip later
# Repeating multi-day events have the same uid so we need to mark each one.
if ($event->{'DTSTART'} eq $event->{'DTEND'} and $event->{'DTEND'}->hour eq 0 and $event->{'DTEND'}->minute eq 0 and $event->{'DTEND'}->second eq 0) {
$eventsbyuid{$uid}{$event->{'DTSTART'}->ymd} = 'rm';
}
} else {
$eventsbyuid{$uid} = $event;
my $curreventday = $event->{'DTSTART'}->clone;
Expand Down Expand Up @@ -321,6 +328,10 @@ sub _process_todos {
my $start = $event->{'DTSTART'};
my $end = $event->{'DTEND'};
my $duration = "";
# Issue 9. All Day events create an event that has zero length and DTSTART and DTEND at 00:00 on last day. Marked while handling multi-day events. Ignore these
if ($start eq $end and $eventsbyuid{$uid}{$start->ymd} and $eventsbyuid{$uid}{$start->ymd} eq 'rm') {
next;
}
if ($end and ($start->hour or $start->minute or $end->hour or $end->minute)) {
# We need both an HH:MM version of the delta, to put in the
# DURATION specifier, and a human-readable version of the
Expand Down

0 comments on commit 4703961

Please sign in to comment.