Re: [calsify] RFC 5545/JSCalendar questions from ECMAScript TC39 "Temporal" working group

Neil Jenkins <neilj@fastmailteam.com> Fri, 31 July 2020 01:49 UTC

Return-Path: <neilj@fastmailteam.com>
X-Original-To: calsify@ietfa.amsl.com
Delivered-To: calsify@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id EEA643A0A66 for <calsify@ietfa.amsl.com>; Thu, 30 Jul 2020 18:49:16 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.119
X-Spam-Level:
X-Spam-Status: No, score=-2.119 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=fastmailteam.com header.b=dw1MlYt0; dkim=pass (2048-bit key) header.d=messagingengine.com header.b=NuWLwcYA
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZQujBzhJNwMJ for <calsify@ietfa.amsl.com>; Thu, 30 Jul 2020 18:49:14 -0700 (PDT)
Received: from new1-smtp.messagingengine.com (new1-smtp.messagingengine.com [66.111.4.221]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 3744C3A0A53 for <calsify@ietf.org>; Thu, 30 Jul 2020 18:49:14 -0700 (PDT)
Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id 7EBBA580641; Thu, 30 Jul 2020 21:49:12 -0400 (EDT)
Received: from imap7 ([10.202.2.57]) by compute4.internal (MEProxy); Thu, 30 Jul 2020 21:49:12 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= fastmailteam.com; h=mime-version:message-id:in-reply-to :references:date:from:to:cc:subject:content-type; s=fm3; bh=mbhI Sbv0mYekLgH4YpuhqjwWfQg4pGhum5zmB4VW68M=; b=dw1MlYt01vGD9Ql/xD+U m5qXYRuEH4/5OxEzKMZrWm1wI7AkfcPgVTDrihfl6VGvQz6zWhZwLWzXJ7ex3mwI U9dsyHjXkRi9EJt2YXyj9m6vTz3XaZEzwAvR5AFSMB6ej776WYO3QaS3qFTlSl9q dT8wcKv0qnX0Grv/axhihHzEwJYIqOW6jGJNkhQmPaAvCQxUkRE7FKIVs49Tq2+o BZ1fmzRgZfORMyGEGVwKgSc+SChG/4sG+CxZhAiL6nRkNKQyozHax5sLqONWMBaP NYVyfRsCpmoUDIC3AV0z8JRc8Gm1i0/0WtoPfhVUUnR91IkeF/psbRE4SUhYMbXJ xw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=mbhISb v0mYekLgH4YpuhqjwWfQg4pGhum5zmB4VW68M=; b=NuWLwcYAgFnLfQApv4cuDk 8/CQAp2Ri9OqZ/W6G9UjyMn4J5DDysch8Ap8egUJw0SgRxH5+Fys0ksw2X3kAozC uPgYyHznTKeN+c0AINMBcblemCipM+D+ZxgFlRJEotSZjMLVpF6SC/pV0Xrkiw17 rL6/h49EDdQ+kDpJgBD72hYh75QLJlbI8EI4Wv1ErpvPIbAWQglVAp0lTb2KEtsJ kxlAIrqxEkjssdkvWkLFxCFhpsL7OJ2eiG4ANJVEYIXfLJ2UDsk6NACEOkxX4mM8 WuCmdh+wmHdIU1xNpzzKNrbuMpRz2/DuInZ0lOIzyOtbq2Xp986KzSj0uRZ9NgIQ ==
X-ME-Sender: <xms:l3gjX9Ru0W8oGFVcqZXKzrUB4ldJm3lRLW2Jtg7-s12JnazCu2bi3w>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrieejgdehtdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvufgtsegrtderreerreejnecuhfhrohhmpedfpfgvihhl ucflvghnkhhinhhsfdcuoehnvghilhhjsehfrghsthhmrghilhhtvggrmhdrtghomheqne cuggftrfgrthhtvghrnhepgffgteeuheekudegieehkefghffguedvueejffeggefgleff udefveevfeekfeefnecuffhomhgrihhnpehgihhthhhusgdrtghomhdpihgvthhfrdhorh hgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepnhgv ihhljhesfhgrshhtmhgrihhlthgvrghmrdgtohhm
X-ME-Proxy: <xmx:l3gjX2zEJBEdBBL1BQuxdOnHRPUuEGzfK-JPaVay7f-11L-qh3Gkvw> <xmx:l3gjXy0CEQhESK8t1tEYbjdlUx-8c0a0WL9f6IoHX0y7gVaTHDZhVg> <xmx:l3gjX1DHkQP6CGW_wwHT5zPW8zFMppjcDqjuy_YZjqi1LH-gNhoOxw> <xmx:mHgjXxNc53imtEnSqU_eGZChPNimEq4-BKI_ZOPVraXMDtF4Vh1oxA>
Received: by mailuser.nyi.internal (Postfix, from userid 501) id A47D1180558; Thu, 30 Jul 2020 21:49:11 -0400 (EDT)
X-Mailer: MessagingEngine.com Webmail Interface
User-Agent: Cyrus-JMAP/3.3.0-128-gd51a832-fm-20200728.001-gd51a8328
Mime-Version: 1.0
Message-Id: <70b795b8-6234-4073-982b-783b10cf3688@dogfood.fastmail.com>
In-Reply-To: <BY5PR14MB35102DF67D362462B62583E6C5710@BY5PR14MB3510.namprd14.prod.outlook.com>
References: <BY5PR14MB35102DF67D362462B62583E6C5710@BY5PR14MB3510.namprd14.prod.outlook.com>
Date: Fri, 31 Jul 2020 11:49:10 +1000
From: Neil Jenkins <neilj@fastmailteam.com>
To: Justin Grant <justin@justingrant.net>, Robert Stepanek <rsto@fastmailteam.com>, Bron Gondwana <brong@fastmailteam.com>, Daniel Migault <daniel.migault@ericsson.com>, Barry Leiba <barryleiba@computer.org>, "Murray S. Kucherawy" <superuser@gmail.com>, "barryleiba@gmail.com" <barryleiba@gmail.com>, Daniel Migault <mglt.ietf@gmail.com>
Cc: "philip.chimento@gmail.com" <philip.chimento@gmail.com>, Shane Carr <sffc@google.com>, Philipp Dunkel <pip@pipobscure.com>, Daniel Ehrenberg <littledan@chromium.org>, calsify@ietf.org
Content-Type: multipart/alternative; boundary="01e008b5a8974bbbbd5695e7dcf18bd7"
Archived-At: <https://mailarchive.ietf.org/arch/msg/calsify/rq04bzw0tF_2fTEY9PAUD1MAMjU>
X-Mailman-Approved-At: Mon, 03 Aug 2020 23:22:04 -0700
Subject: Re: [calsify] RFC 5545/JSCalendar questions from ECMAScript TC39 "Temporal" working group
X-BeenThere: calsify@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: <calsify.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/calsify>, <mailto:calsify-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/calsify/>
List-Post: <mailto:calsify@ietf.org>
List-Help: <mailto:calsify-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/calsify>, <mailto:calsify-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 31 Jul 2020 01:49:17 -0000

On Fri, 31 Jul 2020, at 05:10, Justin Grant wrote:
> Hi JSCalendar team – I’m part of the TC39 working group that’s working on the Temporal <https://github.com/tc39/proposal-temporal> proposal which will be the future date/time API for JavaScript.  We’re planning to follow RFC 5545 for operations that add or subtract durations from date/time values.  But we have some questions about how to interpret the iCalendar spec around edge cases when there’s a DST transition during the added or subtracted duration.

> […]
> P.S. – Apologies for contacting you individually via email instead of via the public mailing list. I tried to join that list but never heard back, so I’m falling back to old-school individual emails.


Hi Justin,

I'm happy to answer some questions; your link was to the GitHub project rather than a specific issue, but I'm presuming it's https://github.com/tc39/proposal-temporal/issues/702 that you were referring to.

I've copied this to the calsify (Calext WG) list <https://www.ietf.org/mailman/listinfo/calsify>, but encourage people to reply-all as you have had difficulty joining it.

In answer to the questions in that issue, my understanding is:

Q1. As specified in RFC5545 (and JSCalendar):
 * A duration does not have a time zone associated with it. It is just an abstract number of weeks/days/hours etc.
 * If you want to determine how long in absolute terms a duration with days/weeks is, this question only makes sense when you have a start date-time to apply it to.
 * A duration may be added or subtracted from a date-time. If the date-time does not have an associated time zone then this is very easy (it's just like UTC: 1 day is always exactly 24h).
 * Otherwise, as per the spec, you would add the weeks/days first to the calendar day/month/year. If the result is an ambiguous time due to DST, you resolve at this point. Then you add the absolute hours/minutes/seconds etc. – this cannot result in another ambiguity. There is only ambiguity mapping from TZ -> UTC, not UTC -> TZ.

I think your implementation in (1) seems similar to this, but I have not looked at the source closely to confirm. I'm not sure why you think the disambiguation in the middle is going to be problematic for users; surely they generally won't notice where it happens? You just add the duration to the date-time and get a result.

If I'm understanding it correctly, I do not think your proposed alternative is acceptable because it applies the time component to the wall-clock time, which means that if you had an event with duration PT1H that started on a 1-hour DST-transition point it would be translated into an absolute duration of 0 hours or 2 hours, which is clearly wrong! e.g. I have an event that starts at 2019-03-31T02:45 in Europe/Berlin. I add a duration of PT1H in wall clock time to get 2019-03-31T03:45 in Europe/Berlin. However, those are the same time in UTC due to the DST transition, so the absolute duration becomes 0!

Q2. I don't think this issue arises when following the RFC5545 semantics above.

Q3. I don't think subtraction is well specified and probably wasn't deeply considered; it is basically only used for the offset of alerts before the start of the event and I think your proposal of subtracting absolute components first is very reasonable for the reason you gave. We should clarify this in the JSCalendar spec.

Q4. This is really an implementation question. The result is clearly only correct if you can add it to the start date and get back the end date again with the already defined semantics. You can either:
 * Just find the difference in absolute time and represent this as a duration in hours/minutes/seconds.
 * Subtract hours/minutes first to get the same wall clock time, then calculate number of days difference to get a duration in weeks/days/hours/minutes/seconds.

Q5. I don't think I quite understand your question. You say you are "calculating differences between UTC values" but then the "difference ends inside a DST discontinuity" – UTC doesn't have DST, so this doesn't make sense. Could you please clarify?

Cheers,
Neil.