<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rfc SYSTEM "rfc2629-xhtml.ent">

<rfc xmlns:xi="http://www.w3.org/2001/XInclude" ipr="trust200902"
     docName="draft-ietf-cbor-date-tag-07" number="8943" obsoletes=""
     updates="" submissionType="IETF" category="std" consensus="true"
     xml:lang="en" tocInclude="true" tocDepth="4" symRefs="true"
     sortRefs="true" version="3"> 

  <!-- xml2rfc v2v3 conversion 3.1.1 -->
  <front>
    <title abbrev="CBOR Tags for Date">Concise Binary Object Representation (CBOR) Tags for Date</title>
    <seriesInfo name="RFC" value="8943"/>
    <author fullname="Michael B. Jones" surname="Jones" initials="M.">
      <organization>Microsoft</organization>
      <address>
        <email>mbj@microsoft.com</email>
        <uri>https://self-issued.info/</uri>
      </address>
    </author>
    <author fullname="Anthony Nadalin" initials="A." surname="Nadalin">
      <organization>Independent</organization>
      <address>
        <email>nadalin@prodigy.net</email>
      </address>
    </author>
    <author fullname="Jörg Richter" initials="J." surname="Richter">
      <organization>pdv Financial Software GmbH</organization>
      <address>
        <email>joerg.richter@pdv-fs.de</email>
      </address>
    </author>
    <date month="November" year="2020"/>
    <area>Applications</area>
    <workgroup>CBOR Working Group</workgroup>
    <keyword>Compact Binary Object Representation</keyword>
    <keyword>CBOR</keyword>
    <keyword>Tag</keyword>
    <keyword>Date</keyword>
    <abstract>
      <t>
	The Concise Binary Object Representation (CBOR), as specified in RFC
	7049, is a data format whose design goals include the possibility of
	extremely small code size, fairly small message size, and
	extensibility without the need for version negotiation.
      </t>
      <t>
	In CBOR, one point of extensibility is the definition of CBOR tags.
	RFC 7049 defines two tags for time:
	CBOR tag 0 (date/time string as per RFC 3339)
	and tag 1 (POSIX "seconds since the epoch").
	Since then, additional requirements have become known.
	This specification defines a CBOR tag for a date text string (as
	per RFC 3339)
	for applications needing a textual date representation
	within the Gregorian calendar without a time.
	It also defines a CBOR tag for days since the date 1970-01-01 in the Gregorian calendar
	for applications needing a numeric date representation without a time.
	This specification is the reference document for IANA registration
	of the CBOR tags defined.
      </t>
    </abstract>
  </front>
  <middle>
    <section anchor="Introduction" numbered="true" toc="default">
      <name>Introduction</name>
      <t>
	The Concise Binary Object Representation (CBOR) <xref target="RFC7049" format="default"/>
	provides for the interchange of structured data
	without a requirement for a pre-agreed schema.
	RFC 7049 defines a basic set of data types, as well as a tagging mechanism
	that enables extending the set of data types supported via an IANA registry.
      </t>
      <t>
	This specification defines a CBOR tag for a text string representing a date without a time.
	The tagged text string is represented as specified by the RFC 3339 <xref target="RFC3339" format="default"/>
        <tt>full-date</tt> production.
	Per RFC 3339, this represents a date within the Gregorian calendar.
      </t>
      <t>
	This specification also defines a CBOR tag for an integer representing a date without a time.
	The tagged integer is an unsigned or negative value indicating the number of days
	since the Gregorian calendar date 1970-01-01.
	As an implementation note, this value has a constant offset from the Modified Julian Date value
	(which is defined by the Smithsonian Astrophysical Observatory as the number of days since
	November 17, 1858); this value is the Modified Julian Date minus 40587.
      </t>
      <t>
	Note that since both tags are for dates without times,
	times of day, time zones, and leap seconds are not applicable to these values.
	These tags are both for representations of Gregorian calendar dates.
      </t>
      <section anchor="CalendarDates" numbered="true" toc="default">
        <name>Calendar Dates</name>
        <t>
	  Calendar dates are used for numerous human use cases,
	  such as marking the dates of significant events.
	  For instance, John Lennon was born on October 9, 1940 and died on December 8, 1980.
	  One such use case is driver's licenses, which typically include a date of birth.
	  The dates used in this specification use the Gregorian calendar,
	  as do those in RFC 3339 <xref target="RFC3339" format="default"/>.
	  The time zones and actual times of these events are intentionally not represented in the calendar date.
        </t>
        <t>
	  The epoch chosen for the second tag, which represents days since the
	  Gregorian calendar date 1970-01-01, is related to the IEEE Std
	  1003.1, 2013 Edition <xref target="POSIX.1" format="default"></xref> time epoch 
	  1970-01-01T00:00:00Z UTC only insofar as both contain the date 1970-01-01.
	  This should not be construed as indicating that dates using this tag
	  represent either a specific time of day and/or time zone.
        </t>
        <t>
	  The day of the week (Sunday, Monday, Tuesday, etc.) is not explicitly represented
	  in either of these date formats.
	  However, deterministic algorithms that are beyond the scope of this specification
	  can be used to derive the day of the week in the Gregorian calendar
	  from dates represented in both of these formats.
        </t>
        <section anchor="Examples" numbered="true" toc="default">
          <name>Example Date Representations</name>
          <t>
	    This table contains example representations for dates using both tags.
          </t>
          <table align="center">
            <thead>
              <tr>
                <th align="left">Date</th>
                <th align="left">Tag 1004</th>
                <th align="left">Tag 100</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td align="left">October 9, 1940</td>
                <td align="left">"1940-10-09"</td>
                <td align="left">-10676</td>
              </tr>
              <tr>
                <td align="left">December 8, 1980</td>
                <td align="left">"1980-12-08"</td>
                <td align="left">3994</td>
              </tr>
            </tbody>
          </table>
        </section>
      </section>
      <section anchor="ComparingDates" numbered="true" toc="default">
        <name>Comparing Dates</name>
        <t>
	  Comparison of dates in <tt>full-date</tt> format can be accomplished by
	  normal string comparison, since, by design, the digits representing the date are in fixed format
	  and ordered from most significant to least significant.
	  Comparison of numeric dates representing days since 1970-01-01 can be performed by
	  normal integer comparison.
	  Comparison of dates in other formats or using other calendars require conversions
	  that are beyond the scope of this specification.
        </t>
        <t>
	  Note that different dates may correspond to the same moment in time,
	  depending upon the time zone in which the date was determined.
	  For instance, at many times of the day, a conference call occurring
	  on a particular date in Japan will simultaneously occur
	  on the previous date in Hawaii;
	  at many times of the day, Japan's Friday corresponds with Hawaii's Thursday.
        </t>
      </section>
      <section anchor="ComparingDatesAndTimes" numbered="true" toc="default">
        <name>Comparing Dates and Date/Time Values</name>
        <t>
	  Comparing dates with date/time values, which represent a particular moment in time,
	  is beyond the scope of this specification.
	  That said, if a date is augmented with a time zone and time of day,
	  a specific date/time value can be determined, and
	  comparing that date/time value to others becomes possible.
	  For instance, if one were to augment John Lennon's birth date
	  of October 9, 1940 with the time of day and time zone of his birth,
	  then it would be possible to derive a date/time at which he was born
	  that could be compared with other date/time values.
        </t>
      </section>
    </section>
    <section anchor="IANA" numbered="true" toc="default">
      <name>IANA Considerations</name>
      <section anchor="cose-algorithms-registrations" numbered="true" toc="default">
        <name>Concise Binary Object Representation (CBOR) Tags Registrations</name>
        <t>
	  This section registers the following values in the
	  IANA "Concise Binary Object Representation (CBOR) Tags" registry <xref target="IANA.cbor-tags" format="default"/>.
        </t>
        <dl newline="false" spacing="compact">
          <dt>Tag:</dt> 
	  <dd>1004</dd>
          <dt>Data Item:</dt>
	  <dd>UTF-8 text string</dd>
	  <dt>Semantics:</dt>
	  <dd><xref target="RFC3339"/> full-date string</dd>
	  <dt>Reference:</dt>
	  <dd>RFC 8943</dd>
        </dl>
        <dl newline="false" spacing="compact">
          <dt>Tag:</dt>
	  <dd>100 (ASCII 'd')</dd>
          <dt>Data Item:</dt>
	  <dd>Unsigned or negative integer</dd>
	  <dt>Semantics:</dt>
	  <dd>Number of days since the epoch date 1970-01-01</dd>
	  <dt>Reference:</dt> 
	  <dd>RFC 8943</dd>
        </dl>
      </section>
    </section>
    <section anchor="Security" numbered="true" toc="default">
      <name>Security Considerations</name>
      <t>
	The security considerations of RFC 7049 apply; the tags introduced
	here are not expected to raise security considerations beyond those.
      </t>
      <t>
	A date, of course, has significant security considerations.
	These include the exploitation of ambiguities where the date is security relevant
	or where the date is used in access control decisions.
      </t>
      <t>
	When using a calendar date for decision making (for example, access control),
	it needs to be noted that since calendar dates do not represent a specific point in time,
	the results of the evaluation can differ depending upon where the decision is made.
	For instance, a person may have reached their 21st birthday in Japan
	while simultaneously being a day short of their 21st birthday in Hawaii.
	Similarly, it would be inappropriate to use only a date to trigger certificate expiration,
	since a date corresponds to a range of times worldwide
	rather than a specific point in time that is independent of geographic location.
      </t>
    </section>
  </middle>
  <back>
<displayreference target="I-D.bormann-cbor-time-tag" to="TIME-TAGS"/>
    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>
      <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.3339.xml"/>
      <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7049.xml"/>
    </references>
      <references>

        <name>Informative References</name>

        <reference anchor="IANA.cbor-tags" target="https://www.iana.org/assignments/cbor-tags">
          <front>
            <title>Concise Binary Object Representation (CBOR) Tags</title>
            <author>
              <organization>IANA</organization>
            </author>
          </front>
        </reference>

        <reference anchor="POSIX.1" target="https://pubs.opengroup.org/onlinepubs/9699919799.2013edition">
          <front>
            <title>The Open Group Base Specifications Issue 7</title>
            <author>
              <organization>IEEE</organization>
            </author>
            <date year="2013"/>
          </front>
          <seriesInfo name="IEEE" value="Std 1003.1"/>
	  <refcontent>2013 Edition</refcontent>
        </reference>
	
	<!-- draft-bormann-cbor-time-tag-03: Expired Internet Draft-->
	<xi:include href="https://datatracker.ietf.org/doc/bibxml3/reference.I-D.bormann-cbor-time-tag-03.xml"/>
      </references>
    </references>
    <section anchor="Acknowledgements" numbered="false" toc="default">
      <name>Acknowledgements</name>
      <t>
	Thanks to <contact fullname="Carsten Bormann"/> for supporting creation of this specification.
	Parts of the explanatory text in this specification come from <xref
	target="I-D.bormann-cbor-time-tag"></xref>. 
      </t>
      <t>
	Thanks to these people for reviews of the specification:
	<contact fullname="Henk Birkholz"/>,
	<contact fullname="Carsten Bormann"/>,
	<contact fullname="Samita Chakrabarti"/>,
	<contact fullname="Roman Danyliw"/>,
	<contact fullname="Linda Dunbar"/>,
	<contact fullname="Benjamin Kaduk"/>,
	<contact fullname="Erik Kline"/>,
	<contact fullname="Warren Kumari"/>,
	<contact fullname="Barry Leiba"/>,
	<contact fullname="Thiago Macieira"/>,
	<contact fullname="Francesca Palombini"/>,
	<contact fullname="Michael Richardson"/>,
	<contact fullname="Kyle Rose"/>,
	<contact fullname="Jim Schaad"/>,
	<contact fullname="Juergen Schoenwaelder"/>,
	<contact fullname="Éric Vyncke"/>,
	<contact fullname="Robert Wilton"/>,
	and
	<contact fullname="Dale Worley"/>.
      </t>
    </section>
  </back>
</rfc>
