bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#54939: 29.0.50; icalendar cannot infer the DTEND from DTSTART + DURA


From: John Hamelink
Subject: bug#54939: 29.0.50; icalendar cannot infer the DTEND from DTSTART + DURATION
Date: Fri, 15 Apr 2022 10:39:20 +0100
User-agent: mu4e 1.6.10; emacs 29.0.50

John Hamelink <me@johnhame.link> writes:
> Great, then I'll have a crack at writing such a patch. I'm new to
> Emacs lisp, but this seems to me like a manageable first task!

OK, so I've implemented something that's approaching spec - but not
ready for full review yet: particularly because I have a problem I
need some guidance on. I have introduced the following tests:

`gnus-icalendar-dtstart-only-date' (Failing)
- `DTSTART' is `DTSTART;TZID=Europe/Berlin:20200915'
- `DTEND' is undefined
- `DURATION' is undefined
- Fails because the `gnus-icalendar--datetimep' returns a truthy
  value.

`gnus-icalendar-dtstart-only-datetime' (Passing)
- `DTSTART' is `DTSTART;TZID=Europe/Berlin:20200915T140000'
- `DTEND' is undefined
- `DURATION' is undefined

`gnus-icalendar-dtstart-duration' (Passing)
- `DTSTART' is `DTSTART;TZID=Europe/Berlin:20200915T140000'
- `DTEND' is undefined
- `DURATION' is `PT3H'

The reason `gnus-icalendar-dtstart-only-date' currently fails is
because I haven't found a good way to differentiate between a date and
a datetime - as the spec requires.

In an attempt to unblock the rest of the implementation, I used the
following:

(defun gnus-icalendar--datep (date)
"return t if DATE matches a date list."
(and (length= date 9)
    (length=
        (seq-filter 'integerp (seq-take date 6))
        3)))

(defun gnus-icalendar--datetimep (datetime)
"Return t if DATETIME matches a date-time list."
(and (length= datetime 9)
(length=
    (seq-filter 'integerp (seq-take datetime 6))
    6)))

This strategy doesn't work. In `icalendar--decode-isodatetime', hours,
minutes and seconds are set to 0 by default, effectively normalising
date to datetime. I wonder if there's a function already implemented
for this that I don't know about yet?

I've included all my patches so far, but I do plan on refactoring more
and then checking my contribution against the contributing guidelines
before formally submitting a patch for review.

I've also sent an email to assign@gnu.org pre-emptively, in case that
is necessary.

Thanks!
JH

Attachment: 0005-lisp-gnus-gnus-icalendar-Add-RFC5545-DTEND-calculati.patch
Description: Text Data

Attachment: 0004-lisp-gnus-gnus-icalendar-Add-gnus-icalendar-event-en.patch
Description: Text Data

Attachment: 0003-lisp-gnus-gnus-icalendar-Add-gnus-icalendar-event-de.patch
Description: Text Data

Attachment: 0003-lisp-gnus-gnus-icalendar-Add-gnus-icalendar-event-de.patch
Description: Text Data

Attachment: 0002-lisp-gnus-gnus-icalendar-Return-nil-if-datefield-cou.patch
Description: Text Data

Attachment: 0001-lisp-gnus-gnus-icalendar-Added-date-and-datetime-pre.patch
Description: Text Data

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]