code4lib / ruby-oai

a Ruby library for building OAI-PMH clients and servers
MIT License
62 stars 43 forks source link

"until" date discrepancy between protocol and implementation. #52

Closed yn closed 2 years ago

yn commented 8 years ago

According to 3.3.1 of OAI-PMH protocol specification: "The legitimate formats are YYYY-MM-DD and YYYY-MM-DDThh:mm:ssZ"

According to 2.7.1 of OAI-PMH protocol specification: "Range limits are inclusive: ... 'until' specifies a bound that must be interpreted as 'less than or equal to'.

The consequences seem to be that {from:"2016-08-20" until:"2016-08-20"} should be interpreted as "everything between midnight and 11:59pm inclusive on August 20th". At least, the BASE OAI verifier at https://www.base-search.net/about/en/suggest.php seems to think so.

Ruby-OAI doesn't interpret it this way. the SQL it generates looks like this:

SELECT COUNT(*) FROM "your_models" where (updated_at >= '2016-08-20 00:00:00' AND updated_at < '2016-08-20 00:00:01')

barmintor commented 2 years ago

This was an error in coercing all from/until conditions into Time regardless of granularity; it was fixed in https://github.com/code4lib/ruby-oai/commit/f2ab31385e1f59e5713eed3aa1ec598dd624c3b2 but I am adding a test to verify it going forward.

barmintor commented 2 years ago

Reopening pending release