From: Jan Tatarik <jan.tatarik@gmail.com>
To: ding@gnus.org
Subject: Re: iCalendar integration - time zone issue
Date: Tue, 12 Nov 2013 14:08:12 +0100 [thread overview]
Message-ID: <87zjp9n4xv.fsf@nb-jtatarik2.xing.hh> (raw)
In-Reply-To: <87wqkeuglx.fsf@topper.koldfront.dk> ("Adam \=\?utf-8\?Q\?Sj\?\= \=\?utf-8\?Q\?\=C3\=B8gren\=22's\?\= message of "Tue, 12 Nov 2013 10:14:18 +0100")
[-- Attachment #1: Type: text/plain, Size: 639 bytes --]
On Tue, Nov 12 2013, Adam Sjøgren wrote:
> Jan Tatarik <jan.tatarik@gmail.com> writes:
>> No, it isn't. It's exactly the same as my W. Europe example, only the
>> name is different.
> Ok, good. It looks thoroughly confusing to me.
>> Yes, this part of the code works fine, the problem occurs later in the
>> pipeline, when the org timestamp is generated. The actual timezone is
>> not used when creating the timestamp, so GMT is assumed by default, and
>> the 1 hour shift happens.
>> I'll fix that.
OK, have something that works for me. Do you mind testing?
You can try either a patch against the latest gnus
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: tz_handling.patch --]
[-- Type: text/x-diff, Size: 4510 bytes --]
diff --git a/lisp/gnus-icalendar.el b/lisp/gnus-icalendar.el
index 969c868b5647158922f9873a49425678c45fd42f..f3b62381b47e79b7f260d5ad8c46ad498096c7d9 100644
--- a/lisp/gnus-icalendar.el
+++ b/lisp/gnus-icalendar.el
@@ -69,14 +69,14 @@
:accessor gnus-icalendar-event:location
:initform ""
:type (or null string))
- (start :initarg :start
- :accessor gnus-icalendar-event:start
+ (start-time :initarg :start-time
+ :accessor gnus-icalendar-event:start-time
:initform ""
- :type (or null string))
- (end :initarg :end
- :accessor gnus-icalendar-event:end
+ :type (or null t))
+ (end-time :initarg :end-time
+ :accessor gnus-icalendar-event:end-time
:initform ""
- :type (or null string))
+ :type (or null t))
(recur :initarg :recur
:accessor gnus-icalendar-event:recur
:initform ""
@@ -125,27 +125,15 @@
(or (match-string 1 rrule)
default-interval)))
-(defmethod gnus-icalendar-event:start-time ((event gnus-icalendar-event))
- "Return time value of the EVENT start date."
- (date-to-time (gnus-icalendar-event:start event)))
-
-(defmethod gnus-icalendar-event:end-time ((event gnus-icalendar-event))
- "Return time value of the EVENT end date."
- (date-to-time (gnus-icalendar-event:end event)))
-
+(defmethod gnus-icalendar-event:start ((event gnus-icalendar-event))
+ (format-time-string "%Y-%m-%d %H:%M" (gnus-icalendar-event:start-time event)))
-(defun gnus-icalendar-event--decode-datefield (ical field zone-map &optional date-style)
- (let* ((calendar-date-style (or date-style 'european))
- (date (icalendar--get-event-property ical field))
- (date-zone (icalendar--find-time-zone
- (icalendar--get-event-property-attributes
- ical field)
- zone-map))
- (date-decoded (icalendar--decode-isodatetime date nil date-zone)))
+(defun gnus-icalendar-event--decode-datefield (ical field)
+ (let* ((date (icalendar--get-event-property ical field))
+ (date-props (icalendar--get-event-property-attributes ical field))
+ (tz (plist-get date-props 'TZID)))
- (concat (icalendar--datetime-to-iso-date date-decoded "-")
- " "
- (icalendar--datetime-to-colontime date-decoded))))
+ (date-to-time (timezone-make-date-arpa-standard date nil tz))))
(defun gnus-icalendar-event--find-attendee (ical name-or-email)
(let* ((event (car (icalendar--all-events ical)))
@@ -166,7 +154,6 @@
(defun gnus-icalendar-event-from-ical (ical &optional attendee-name-or-email)
(let* ((event (car (icalendar--all-events ical)))
- (zone-map (icalendar--convert-all-timezones ical))
(organizer (replace-regexp-in-string
"^.*MAILTO:" ""
(or (icalendar--get-event-property event 'ORGANIZER) "")))
@@ -180,8 +167,8 @@
(gnus-icalendar-event--find-attendee ical attendee-name-or-email)))
(args (list :method method
:organizer organizer
- :start (gnus-icalendar-event--decode-datefield event 'DTSTART zone-map)
- :end (gnus-icalendar-event--decode-datefield event 'DTEND zone-map)
+ :start-time (gnus-icalendar-event--decode-datefield event 'DTSTART)
+ :end-time (gnus-icalendar-event--decode-datefield event 'DTEND)
:rsvp (string= (plist-get (cadr attendee) 'RSVP)
"TRUE")))
(event-class (cond
@@ -363,10 +350,10 @@ Return nil for non-recurring EVENT."
"Build `org-mode' timestamp from EVENT start/end dates and recurrence info."
(let* ((start (gnus-icalendar-event:start-time event))
(end (gnus-icalendar-event:end-time event))
- (start-date (format-time-string "%Y-%m-%d %a" start t))
- (start-time (format-time-string "%H:%M" start t))
- (end-date (format-time-string "%Y-%m-%d %a" end t))
- (end-time (format-time-string "%H:%M" end t))
+ (start-date (format-time-string "%Y-%m-%d %a" start))
+ (start-time (format-time-string "%H:%M" start))
+ (end-date (format-time-string "%Y-%m-%d %a" end))
+ (end-time (format-time-string "%H:%M" end))
(org-repeat (gnus-icalendar-event:org-repeat event))
(repeat (if org-repeat (concat " " org-repeat) "")))
[-- Attachment #3: Type: text/plain, Size: 51 bytes --]
or just replace the whole gnus-icalendar.el file
[-- Attachment #4: gnus-icalendar.el --]
[-- Type: application/emacs-lisp, Size: 34926 bytes --]
[-- Attachment #5: Type: text/plain, Size: 20 bytes --]
and restart emacs.
next prev parent reply other threads:[~2013-11-12 13:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-11 15:08 Adam Sjøgren
2013-11-11 22:58 ` Jan Tatarik
2013-11-11 23:29 ` Adam Sjøgren
2013-11-12 9:07 ` Jan Tatarik
2013-11-12 9:14 ` Adam Sjøgren
2013-11-12 13:08 ` Jan Tatarik [this message]
2013-11-12 17:27 ` Adam Sjøgren
2013-11-27 17:04 ` Mario Peter
2013-11-27 23:54 ` Jan Tatarik
2013-11-28 20:22 ` Jan Tatarik
2013-11-28 21:20 ` Jan Tatarik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zjp9n4xv.fsf@nb-jtatarik2.xing.hh \
--to=jan.tatarik@gmail.com \
--cc=ding@gnus.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).