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

Justin Grant <justingrant.ietf.public@gmail.com> Tue, 29 September 2020 23:43 UTC

Return-Path: <justingrant.ietf.public@gmail.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 26E1F3A13DF for <calsify@ietfa.amsl.com>; Tue, 29 Sep 2020 16:43:31 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.097
X-Spam-Level:
X-Spam-Status: No, score=-2.097 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, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, SPF_HELO_NONE=0.001, 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=gmail.com
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 uNB6vNMXYKYp for <calsify@ietfa.amsl.com>; Tue, 29 Sep 2020 16:43:29 -0700 (PDT)
Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 1013A3A13CE for <calsify@ietf.org>; Tue, 29 Sep 2020 16:43:29 -0700 (PDT)
Received: by mail-ed1-x534.google.com with SMTP id e22so8640276edq.6 for <calsify@ietf.org>; Tue, 29 Sep 2020 16:43:28 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5C/vK84g0HmFegWmQtjuv9uD5e5VMJ2rbKnBWzdCMtA=; b=DiuM9uiHz84kT0wfrE+LMAxVA1C/YbSD5qsLe9uMnEOMwhawzEt4yIS0cxtyD8tz4o 2rlfG8/RTHInI4YaSMPrz0wD1Xj0i46A58IF7Q9P98QUyY7c7C2VMyV2XIhj6k216oKN 5JO9rpTRmF7nkbgYf2LHl2XD63/QEWMF/j7WCNPlPjTm+MBvZ8uAwvJZ84Geyhw7qCx0 bWpZaaKrzE6XGNIfnApruupiOajB8XTd7QoZkgNwAO9na64F3tmqtZJBpSIvZbhf9nEb 27Y0zNDKjTH3Cknv1/n+0EgIjQ2dIAveXlI288nEdexl9OZ2ycJqsdb4EpB35PKqA5Mp fjyw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5C/vK84g0HmFegWmQtjuv9uD5e5VMJ2rbKnBWzdCMtA=; b=IXfefHPOawTX9XztzkjUjXtjVm0dKXjeu0ytt9mgICd0ffCHt3H3PgfrKg4ZKP7M+T cD3I3JbuO7t2Z6bYfLLbcy2wX+fd1kXkpfnRKfqqHl8JqxRWkAdsJvNtHOM47x6uuJEZ FktkbL0rVYmoCF8eGJVoChYsn8SNPSRb/G4myUnX+ARx6vOQVIdLhQJ1hP0hAHo+VAx5 KcK98YvnHmJBfjsc7RsRqGDU92MS5Ea0/PUD3SFzuo06p1dfmeanRPV/imJg1qoSjWOc oMuJQ5Z8HnHV7eqwa9U+BwH11tacINHZsmxeVUW3kmTQXvScPnkDLx643X/Llb1OJHY2 ca9g==
X-Gm-Message-State: AOAM530Q138gYYEJ03aHdIaZrsvjyKfnHvExCLdUMEN+S6U15rmaD+jY 0bBfpna2fzucSylxhzRV6b/P7Zie7uNNeNdgbamAlXVxWlA=
X-Google-Smtp-Source: ABdhPJzeH7EX/f+9VXZ2B/OWG8KlYQ3XUPEshJGjwsDeA8rkAwm6+3mZFCr72PEz3Flh8RHyekavHx+jOJ8qgxvn4VQ=
X-Received: by 2002:a50:f102:: with SMTP id w2mr6094558edl.63.1601423007578; Tue, 29 Sep 2020 16:43:27 -0700 (PDT)
MIME-Version: 1.0
References: <CACy7CficiNXA_tb01c0=PWQTnXPVu_e7TgWAKUVPY-ow9C=3SQ@mail.gmail.com> <5bfd4453-e9a9-4bf4-b403-1b2f19cc790a@dogfood.fastmail.com> <CACy7CfgbPG_ugC59CZWtMwA7w4UOJR=zUkovKzvHUdeoFxnpjg@mail.gmail.com> <6d357b96-9899-4bd3-93e0-97e147a86a4d@dogfood.fastmail.com> <CACy7Cfjfdu7yyjvVCcvYag7AVMrekqiSCfm6pQZ8PiQLFiJ7Aw@mail.gmail.com> <CACy7CfgBBHxu=gHirXs3xVc30psU0+F-E0ttiUiJ4KvSCR9Qew@mail.gmail.com> <e0656c88-6a1b-49b0-9fa4-14a794e9fb82@dogfood.fastmail.com>
In-Reply-To: <e0656c88-6a1b-49b0-9fa4-14a794e9fb82@dogfood.fastmail.com>
From: Justin Grant <justingrant.ietf.public@gmail.com>
Date: Tue, 29 Sep 2020 16:43:16 -0700
Message-ID: <CACy7CfhKg2rZsdPy0ELVrGwGdDvg+ELQWYN+YMrsYEyc6_8BJQ@mail.gmail.com>
To: Neil Jenkins <neilj@fastmailteam.com>
Cc: calsify@ietf.org
Content-Type: multipart/alternative; boundary="000000000000807cfc05b07c5913"
Archived-At: <https://mailarchive.ietf.org/arch/msg/calsify/Z8iChkg9EHhjVCG1C4Z26iIxs74>
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: Tue, 29 Sep 2020 23:43:31 -0000

Hi Neil - I'm working on a sample implementation of the algorithms we've
been discussing for addition, subtraction, and calculating the difference
between date/time values.

I'm trying to figure out if there's an algorithm that can make all
operations reversible, meaning that the last two comparisons below should
be true:
* let START = some date/time value with a time zone
* let D = some duration
* let END = START + D
* let DIFF = END - START
* let UNDO = END - DIFF
* assert DIFF == D
* assert UNDO == START

But if E falls inside a DST skipped hour, then I'm not sure that both the
comparisons can be true. Example:

* START = 2020-03-07T02:30-08:00[America/Los_Angeles]
* D = P1D
* END = START + D == 2020-03-07T03:30-07:00[America/Los_Angeles]
* DIFF = END - START == P1D (OK)
* UNDO = END - DIFF == 2020-03-07T03:30-08:00[America/Los_Angeles]
* UNDO != START (3:30 vs. 2:30)

I think this result is probably OK (because DST is weird) but I'm wondering
if the difference calculation in this case should return P1D (which makes
`end - start == P1D`) or P1DT1H (which would make `undo == start`). Or is
there some possible algorithm which could make both comparisons true?  If
not, then would it be better for the first comparison to work and the
second to fail, or is it better for the second to work and the first to
fail?

Cheers,
Justin


On Sun, Aug 16, 2020 at 4:39 PM Neil Jenkins <neilj@fastmailteam.com> wrote:

> On Sun, 16 Aug 2020, at 05:16, Justin Grant wrote:
>
> Hi Neil - reviewing this now. Had a quick question:
>
> > Let T = Y - X in absolute time => PT23H45M
>
> Why is X used here instead of I?  Here's what I would have expected:
>
> Let T = Y - *I* in absolute time  => PT23H45M
>
>
> Correct. This was an error, it should be *I* as you say.
>
> Neil.
>