Bug #5202

Creation dates showing as ####-11-29 when entered as YYYY-00-00 in search results

Added by Dan Gillean almost 9 years ago. Updated over 8 years ago.

Status:VerifiedStart date:06/07/2013
Priority:MediumDue date:
Assignee:José Raddaoui Marín% Done:


Category:Search / BrowseEstimated time:2.00 hours
Target version:Release 2.0.0
Google Code Legacy ID: Tested version:
Sponsored:No Requires documentation:


To Reproduce
Navigate to Browse > archival descriptions
Filter the search results to Series

Resulting error
Note that all the dates showing are YYYY-11-29

Expected result
Dates with only a year entered will display only the year


#1 Updated by Jesús García Crespo almost 9 years ago

  • Target version changed from Release 2.0 - interim 1 to Release 2.0.0

Dates have been hidden temporary.

#2 Updated by Jesús García Crespo almost 9 years ago

  • Estimated time set to 2.00

#3 Updated by Jesús García Crespo over 8 years ago

  • Assignee changed from Jesús García Crespo to José Raddaoui Marín

#4 Updated by José Raddaoui Marín over 8 years ago

  • Status changed from New to In progress

We have a little problem here.

If a start/end date is entered without month or day, MySQL stores those values like zeros. For example:

2013-06 will be 2013-06-00 in the database
1983 will be 1983-00-00 in the database

The problem happens when you transform those dates into PHP/ElasticSearch dates. Zero values are not allowed in ISODateTimeFormat and they are transformed into the previous date. So:

2013-06-00 --> 2013-05-31
1983-00-00 --> 1982-12-00 --> 1982-11-30 (in two steps)

First thing I think we'll need to do is change those zeros before transforming the date, so the dates in ElasticSearch looks like:

Start date cases:
2013-06-00 --> 2013-06-01
1983-00-00 --> 1983-01-01

End date cases:
2013-06-00 --> 2013-06-30
1983-00-00 --> 1983-12-31

With different start/end cases to allow a proper date range search (when we include the date range search in 2.x)

But then we have the problem about how are we going to show those dates in the search results. I'll need to do a little more research to see if we can add a property to the modified dates in ElasticSearch, so we can modify it back before showing the date.

Please, let me know if you have any thoughts.

#5 Updated by José Raddaoui Marín over 8 years ago

  • Status changed from In progress to QA/Review
  • % Done changed from 0 to 100

Applied in changeset atom|commit:c0044e8a405859b79ca08225328386aefdfd5636.

#6 Updated by José Raddaoui Marín over 8 years ago

I'll modify the dates when we add the date range search. For now I've added string dates to the search index, so this should be fixed.

PS. You'll need to re-populate de search index.

#7 Updated by Dan Gillean over 8 years ago

  • Status changed from QA/Review to Verified

I don't fully understand all the technicalities behind this, but currently it seems to be working in the interface.

Some thoughts:

Many people will only enter one date - at which point the start and end dates are automatically populated for start and end. In these cases, though they should NOT be saved as such, for searching purposes we must assume that if the date is 1980, on a search it will be treated as Start = 1980-01-01 and End = 1980-12-31

I wonder if we can't just make a rule that whenever 2 zeros appear in a date that are NOT part of a larger number (such as 2000), they are stripped?

Anyways, this seems to be working now, so I'll clear this issue and let you work out the details! :D

Also available in: Atom PDF