specify / specify7

Specify 7
https://www.specifysoftware.org/products/specify-7/
GNU General Public License v2.0
66 stars 36 forks source link

'Day' and 'Month' date fields return `1` when the date is not complete in queries #4503

Open grantfitzsimmons opened 8 months ago

grantfitzsimmons commented 8 months ago

Describe the bug

In the database, Specify stores the dates as 1/1/YYYY when only the year is known and indicated to Specify 6 that the 1s should be ignored based on the DateFieldPrecision value (for precise dates). Specify 7 has not had this logic implemented, therefore you are seeing the issue you described:

Another thing I noticed just this morning is that the Specify 7 query does not take the date precision in account when calculating Month and Day values. So, for a record with an eventDate of just '1876', Specify 6 gives:

image

and Specify 7 gives:

image

I only use the Day and Month fields because I thought I could not access the DatePrecision in the query and it turns out that I was wrong, so I can probably fix this myself. However, I thought I'd note the discrepancy between Specify 6 and 7. People might rely on the Month and/or Day fields to be blank to know that they are dealing with an incomplete date.

To Reproduce Steps to reproduce the behavior:

  1. Build a query on a date field
  2. Make sure the date is set to just a year
  3. Query on 'Day', 'Month', and 'Year'
  4. See that Day and Month return 1 instead of nothing

Expected behavior It should show no number, not 1.

Reported By @nielsklazenga on the Speciforum

specifysoftware commented 8 months ago

This issue has been mentioned on Specify Community Forum. There might be relevant details there:

https://discourse.specifysoftware.org/t/issues-with-dates-and-timestamps-in-specify-7-query/1538/2

emenslin commented 3 months ago

Can recreate in edge (7.9.6)

grantfitzsimmons commented 3 months ago

Causing issues when building reports as well as indicating false precision in exports (see https://discourse.specifysoftware.org/t/ireport-and-jaspersoft-studio-useful-expressions/384/3?u=grant)

specifysoftware commented 3 months ago

This issue has been mentioned on Specify Community Forum. There might be relevant details there:

https://discourse.specifysoftware.org/t/ireport-and-jaspersoft-studio-useful-expressions/384/4