Hi Christof,
The enclosed is a public working version of version of 8601 from 2016. (https://web.archive.org/web/20171019211402/https://www.loc.gov/standards/datetime/ISO_DIS%208601-1.pdf)
Public non-normative versions of 8601 are here:
https://www.iso.org/obp/ui/#iso:std:iso:8601:-1:ed-1:v1:en and
https://www.iso.org/obp/ui/#iso:std:iso:8601:-2:ed-1:v1:en 8601-2:2019 defines date and time arithmetic extensions. However these are not described in the public versions. My experience with other groups is that lack of public availability is a significant barrier
to acceptance.
George
From: Christof Sprenger <
chrispre@microsoft.com>
Sent: Thursday, September 17, 2020 10:02 PM
To: Ericson, George; Handl, Ralf
Cc:
odata@lists.oasis-open.org Subject: ODATA-1394 [was: 8601 used by Redfish]
[EXTERNAL EMAIL]
Hi,
I did some more research around
ODATA-1394
a) I was not able to find anything that states that ISO 8601 talks about the arithmetic operations for durations or any other type.
I can not guarantee that they don t since the ISO standard requires a license and I do not have access to a licensed version but I couldn t find any indication that it does.
b) I had to double check it myself and can now confidently confirm what you, Ralf brought up .
When adding 1 month and 2 days to 2019-02-27
Month first leads to 2019-03-29 (2019-02-27 -> 2019-03-27 -> 2019-02-29 ) Days first leads to 2019-04-01 (2019-02-27 -> 2019-03-01 -> 2019-04-01 )
And as a side note, the equivalent is not true for 2020-02-27 (2020 is a leap year).
It confirms calendar math is messy.
I am still willing to say that a Year-Month-Day duration and its arithmetic operation
can be well defined (see below).
c) The very powerful Java library JODA-time (which is essentially the de-factor standard programming library for java), this type is calling this type Period .
They are distinguishing between Duration which is sort of calendar independent and Period which is the human readable calendar duration which is equivalent to the ISO 8601 duration
In the
documentation of the class when they describe one constructor,
public Period( ReadableInstant startInstant, ReadableInstant endInstant)
It says (emphasize mine)
Most calculations
performed by this method have obvious results . The special case is where the calculation is from a "long" month to a "short" month. Here, the result
favours increasing the months field rather than the days . For example, 2013-01-31 to 2013-02-28 is treated as one whole month. By contrast, 2013-01-31 to 2013-03-30 is treated as one month and 30 days (exposed as 4 weeks and 2 days). The results are
explained by considering that the start date plus the calculated period result in the end date.
I couldn t find anything where they talk about addition of Date + Period. But I believe the statement above implicitly says that there is an order Years, Month, Days in these operations
d) a very powerful .NET/C# library that is somewhat inspired by JODA is called NODA (
)
I was able to find the documentation for addition of a Period to a DateTime
Addition(LocalDateTime, Period) (DateTime has the suffix local to indicate it is a date in a particular calendar system)
It says (emphasize mine):
Adds a period to a local date/time. Fields are
added in descending order of significance (years first, then months, and so on ). This is a convenience operator over the Plus(Period) method.
It doesn t add much motivation for it but is resolving the ambiguity that Ralf mentioned above (see b) )
Christof
From:
odata@lists.oasis-open.org <
odata@lists.oasis-open.org >
On Behalf Of Ericson, George
Sent: Thursday, September 17, 2020 09:36
To:
odata@lists.oasis-open.org Subject: [EXTERNAL] [odata] 8601 used by Redfish
ISO 8601 is only supported via annotation description in Redfish.
For example:
< Property
Name =" EnabledIntervals "
Type =" Collection(Edm.String) ">
< Annotation
Term =" OData.Permissions "
EnumMember =" OData.Permission/ReadWrite "/>
< Annotation
String =" Intervals when scheduled occurrences are enabled. "
Term =" OData.Description "/>
< Annotation
String =" Each value shall be an ISO 8601 conformant interval specifying when occurences are enabled. "
Term =" OData.LongDescription "/>
</Property>
Note: Long descriptions are considered normative in Redfish.
George
Attachment: ISO_DIS 8601-1.pdf Description: ISO_DIS 8601-1.pdf