GNU bug report logs -
#54939
29.0.50; icalendar cannot infer the DTEND from DTSTART + DURATION
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
John Hamelink <me <at> 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 <at> gnu.org pre-emptively, in case that
is necessary.
Thanks!
JH
[0005-lisp-gnus-gnus-icalendar-Add-RFC5545-DTEND-calculati.patch (text/x-patch, attachment)]
[0004-lisp-gnus-gnus-icalendar-Add-gnus-icalendar-event-en.patch (text/x-patch, attachment)]
[0003-lisp-gnus-gnus-icalendar-Add-gnus-icalendar-event-de.patch (text/x-patch, attachment)]
[0003-lisp-gnus-gnus-icalendar-Add-gnus-icalendar-event-de.patch (text/x-patch, attachment)]
[0002-lisp-gnus-gnus-icalendar-Return-nil-if-datefield-cou.patch (text/x-patch, attachment)]
[0001-lisp-gnus-gnus-icalendar-Added-date-and-datetime-pre.patch (text/x-patch, attachment)]
[signature.asc (application/pgp-signature, inline)]
This bug report was last modified 3 years and 116 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.