# Datetime spec, please review

**URL:** <https://discourse.citationstyles.org/t/datetime-spec-please-review/1034>\
**Category:** CSL Development\
**Created:** [August 12, 2011, 7:38pm UTC](https://discourse.citationstyles.org/t/datetime-spec-please-review/1034 "2011-08-12T19:38:54Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bruce\_D\_Arcus1](https://avatars.discourse-cdn.com/v4/letter/b/4bbf92/32.png) [@Bruce\_D\_Arcus1](https://discourse.citationstyles.org/u/Bruce_D_Arcus1)\
**Post date:** [August 12, 2011, 7:38pm UTC](https://discourse.citationstyles.org/t/datetime-spec-please-review/1034/1 "2011-08-12T19:38:54Z")

</div>

I’ll be away the next two weeks (and much of the week following). It would  
be good if those of you who have time could review the specification:

[http://www.loc.gov/standards/datetime/spec.html](http://www.loc.gov/standards/datetime/spec.html)

and the bnf

[http://www.loc.gov/standards/datetime/bnf.html](http://www.loc.gov/standards/datetime/bnf.html)

during the next three weeks.

I’d like to think that the spec is stable, but I suspect that there are some  
errors/discrepancies in the bnf. BNFs are always better when more people  
look at them.

–Ray---------- Forwarded message ----------  
From: “Denenberg, Ray” [rden@loc.gov](mailto:rden@loc.gov)  
Date: Aug 12, 2011 3:32 PM  
Subject: Datetime spec, please review  
To: [DATETIME@listserv.loc.gov](mailto:DATETIME@listserv.loc.gov)

---

<div class="post-metadata">

**Author:** ![Avram\_Lyon](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@Avram\_Lyon](https://discourse.citationstyles.org/u/Avram_Lyon)\
**Post date:** [August 13, 2011, 9:13am UTC](https://discourse.citationstyles.org/t/datetime-spec-please-review/1034/2 "2011-08-13T09:13:40Z")

</div>

I’m glad to see that season made the final specification. I think that  
CSL would be well-served by Level 1 with some elements of Level 2 (a  
complete implementation of Level 2 might be too much to ask in the  
near future). Specifically, the multiple dates (203, 204) and calendar  
(207) elements of Level 2 have demonstrated demand in the citation  
world; both have come up multiple times on the Zotero forums.

We talked about making EDTF a part of CSL; it looks like we’ll be able  
to take Level 1 or Level 1+some bits of level 2 and make that happen.

We’ll probably need to agree on sorting for seasons and a calendar  
vocabulary, both unspecified by the current document, but this looks  
like a nice improvement, and pretty much exactly what we needed.

Avram

---

<div class="post-metadata">

**Author:** ![Sylvester\_Keil](https://avatars.discourse-cdn.com/v4/letter/s/85e7bf/32.png) [@Sylvester\_Keil](https://discourse.citationstyles.org/u/Sylvester_Keil)\
**Post date:** [August 15, 2011, 3:48pm UTC](https://discourse.citationstyles.org/t/datetime-spec-please-review/1034/3 "2011-08-15T15:48:08Z")

</div>

I’ve updated the edtf Ruby gem to reflect the latest draft. The parser is based on the BNF with minimal changes to resolve a few conflicts and it works for all extensions except 201 and 205. The multiple dates (203, 204) right now return a simple array, which is to say that whilst features such as earlier/later are parsed correctly, that information is not exposed by the API. Eventually, we will need a new class to wrap these sets of dates.

A few minor issues will have to be resolved (e.g., how to deal with open/unknown intervals or how to sort intervals and seasons), but overall you should be able to experiment with the format if you are so inclined. Simply, gem install and require ‘edtf’; you then parse EDTF with the Date.edtf class method.

Sylvester

---

<div class="post-metadata">

**Author:** ![Bruce\_D\_Arcus1](https://avatars.discourse-cdn.com/v4/letter/b/4bbf92/32.png) [@Bruce\_D\_Arcus1](https://discourse.citationstyles.org/u/Bruce_D_Arcus1)\
**Post date:** [August 15, 2011, 3:55pm UTC](https://discourse.citationstyles.org/t/datetime-spec-please-review/1034/4 "2011-08-15T15:55:44Z")

</div>

> I’ve updated the edtf Ruby gem to reflect the latest draft.

Awesome!

> The parser is based on the BNF with minimal changes to resolve a few conflicts and it works for all extensions except 201 and 205. The multiple dates (203, 204) right now return a simple array, which is to say that whilst features such as earlier/later are parsed correctly, that information is not exposed by the API. Eventually, we will need a new class to wrap these sets of dates.
> 
> A few minor issues will have to be resolved (e.g., how to deal with open/unknown intervals or how to sort intervals and seasons), but overall you should be able to experiment with the format if you are so inclined. Simply, gem install and require ‘edtf’; you then parse EDTF with the Date.edtf class method.

So does this suggest, then, that you’re happy with the spec? I tried  
very much to be a voice for keeping it more-or-less easy-to-implement  
(and therefore cutting features of questionable benefit that might not  
be).

Now’s the time to get in feedback.

Bruce

---

<div class="post-metadata">

**Author:** ![Bruce\_D\_Arcus1](https://avatars.discourse-cdn.com/v4/letter/b/4bbf92/32.png) [@Bruce\_D\_Arcus1](https://discourse.citationstyles.org/u/Bruce_D_Arcus1)\
**Post date:** [August 15, 2011, 4:01pm UTC](https://discourse.citationstyles.org/t/datetime-spec-please-review/1034/5 "2011-08-15T16:01:49Z")

</div>

Is the following correct according to the spec (note end “to” date for  
the interval)?

irb(main):014:0\> d = Date.edtf(‘1984/1985’)  
=\> #\<EDTF::Interval:0x45932c @from=#\<Date: 1984-01-01  
(4891401/2,0,2299161)\>, @to=#\<Date: 1985-01-01 (4892133/2,0,2299161)\>\>  
irb(main):015:0\> d.from.to\_s  
=\> "1984-01-01"  
irb(main):016:0\> d.to.to\_s  
=\> “1985-01-01”

Bruce

---

<div class="post-metadata">

**Author:** ![Sylvester\_Keil](https://avatars.discourse-cdn.com/v4/letter/s/85e7bf/32.png) [@Sylvester\_Keil](https://discourse.citationstyles.org/u/Sylvester_Keil)\
**Post date:** [August 15, 2011, 4:09pm UTC](https://discourse.citationstyles.org/t/datetime-spec-please-review/1034/6 "2011-08-15T16:09:06Z")

</div>

Well spotted! Reading the spec again it’s probably more like 1984-01-01T00:00:00 to 1985-12-31:23:59:59. The Interval class will have to be fleshed out in the future. Right now it is a very thin wrapper around a Range.

Sylvester

---

<div class="post-metadata">

**Author:** ![Sylvester\_Keil](https://avatars.discourse-cdn.com/v4/letter/s/85e7bf/32.png) [@Sylvester\_Keil](https://discourse.citationstyles.org/u/Sylvester_Keil)\
**Post date:** [August 15, 2011, 4:18pm UTC](https://discourse.citationstyles.org/t/datetime-spec-please-review/1034/7 "2011-08-15T16:18:34Z")

</div>

It just occurred to me that I may have misunderstood your question slightly. I implemented Interval so as to stay very close to regular Ranges in order to support checks such as whether or not a given date falls into the interval. For that reason, we need the ‘from’ and ‘to’; however, the Interval class will remember that the start and end date were specified using ‘year precision’; this is important if we want to generate an EDTF string from the Interval and may be important for other checks. So, in other words, the from/to are not intended to be a direct mapping of the EDTF string, rather the Interval object is the mapping and will eventually need to expose a better API to all the features provided by EDTF intervals.

Sylvester

---

<div class="post-metadata">

**Author:** ![Sylvester\_Keil](https://avatars.discourse-cdn.com/v4/letter/s/85e7bf/32.png) [@Sylvester\_Keil](https://discourse.citationstyles.org/u/Sylvester_Keil)\
**Post date:** [August 15, 2011, 4:24pm UTC](https://discourse.citationstyles.org/t/datetime-spec-please-review/1034/8 "2011-08-15T16:24:49Z")

</div>

I’m happy with the spec so far. I’ve used the BNF for now, but it might be quicker to implement the parser with regular expressions (and then rule out some border cases programmatically) – or, if you know a parser generator for javascript, we might be able to quickly port the parser, too.

Sylvester

---

<div class="post-metadata">

**Author:** ![Bruce\_D\_Arcus1](https://avatars.discourse-cdn.com/v4/letter/b/4bbf92/32.png) [@Bruce\_D\_Arcus1](https://discourse.citationstyles.org/u/Bruce_D_Arcus1)\
**Post date:** [August 15, 2011, 4:36pm UTC](https://discourse.citationstyles.org/t/datetime-spec-please-review/1034/9 "2011-08-15T16:36:01Z")

</div>

I don’t, but a quick google search turned up this:

[https://github.com/jessesielaff/Riff](https://github.com/jessesielaff/Riff)

??

Bruce

---

<div class="post-metadata">

**Author:** ![Sylvester\_Keil](https://avatars.discourse-cdn.com/v4/letter/s/85e7bf/32.png) [@Sylvester\_Keil](https://discourse.citationstyles.org/u/Sylvester_Keil)\
**Post date:** [August 15, 2011, 4:40pm UTC](https://discourse.citationstyles.org/t/datetime-spec-please-review/1034/10 "2011-08-15T16:40:21Z")

</div>

This may just be ideal; I am using racc myself, so my grammar file should work right away.

---

<div class="post-metadata">

**Author:** ![Rintze\_Zelle](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.citationstyles.org/rintze_zelle/32/175_2.png) [@Rintze\_Zelle](https://discourse.citationstyles.org/u/Rintze_Zelle)\
**Post date:** [August 16, 2011, 5:41pm UTC](https://discourse.citationstyles.org/t/datetime-spec-please-review/1034/11 "2011-08-16T17:41:48Z")

</div>

Reviewing the EDTF draft, I just noticed the distinction between uncertain  
and approximate dates. Unfortunately, this got mixed up a bit in CSL 1.0 (we  
have an is-uncertain-date conditional, but the spec gives an example of its  
use for an approximate date). We could introduce an additional  
is-approximate-date conditional, if desired.

Rintze

---

<div class="post-metadata">

**Author:** ![Bruce\_D\_Arcus1](https://avatars.discourse-cdn.com/v4/letter/b/4bbf92/32.png) [@Bruce\_D\_Arcus1](https://discourse.citationstyles.org/u/Bruce_D_Arcus1)\
**Post date:** [August 16, 2011, 7:10pm UTC](https://discourse.citationstyles.org/t/datetime-spec-please-review/1034/12 "2011-08-16T19:10:27Z")

</div>

To be honest, I don’t really understand the practical difference  
between the two, or how we would represent them, beyond “c.2000”.

Thoughts?

Bruce

---

<div class="post-metadata">

**Author:** ![Rintze\_Zelle](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.citationstyles.org/rintze_zelle/32/175_2.png) [@Rintze\_Zelle](https://discourse.citationstyles.org/u/Rintze_Zelle)\
**Post date:** [August 16, 2011, 7:19pm UTC](https://discourse.citationstyles.org/t/datetime-spec-please-review/1034/13 "2011-08-16T19:19:47Z")

</div>

[http://www.loc.gov/standards/datetime/spec.html](http://www.loc.gov/standards/datetime/spec.html) includes definitions of the  
two. Anyway, it’s not a big problem, but ideally we should have used  
is-approximate-date instead of is-uncertain-date.

Rintze

---

<div class="post-metadata">

**Author:** ![Sylvester\_Keil](https://avatars.discourse-cdn.com/v4/letter/s/85e7bf/32.png) [@Sylvester\_Keil](https://discourse.citationstyles.org/u/Sylvester_Keil)\
**Post date:** [September 3, 2011, 7:27am UTC](https://discourse.citationstyles.org/t/datetime-spec-please-review/1034/14 "2011-09-03T07:27:19Z")

</div>

As far as I understand it, the practical distinction is that approximate (~) dates express a certain degree of confidence (e.g., 2001~ means c. 2001, it might have been 2000 or 2002 but in any case it is close to 2001), whereas uncertain (?) dates could be farther off (e.g., 1838? could mean 1838, or was it 1383?).

Where bibliographic references are concerned I think only approximate dates are actually used. It wouldn’t hurt to support both, though. In any case, I agree with Rintze that it would probably be a good idea to introduce the is-approximate-date conditional.

Best,  
Sylvester
