Support #381

Change DateTimeISO to exclude impossible dates

Added by B. Baltruschat over 7 years ago. Updated about 7 years ago.

Status:NewStart date:11/16/2016
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:XML Schema
Target version:-
Milestones:

Description

via David Fichtmüller from ABCD Wiki ( http://abcd.biowikifarm.net/wiki/Internal:ABCD_Corrections#Change_DateTimeISO_to_exclude_impossible_dates )

(Improvement    not backward compatible    Status: Suggested)

With the current definition of the DateTimeISO type it is valid to have impossible dates like 2012-04-31. The Regular Expression (RegEx) used to define the DateTimeISO type could be modified to exclude these types. Only checking for leap years is not possible with RegEx, so the 29th of February will be a valid day even for non-leap-years.

If all of the changes suggested above for the type DateTimeISO are accepted, the new RegEx would be

\d\d\d\d(\-((0[1-9]|1[012])|((0[13578]|1[02])\-((0[1-9])|1\d|2\d|3[01])|(0[469]|11)\-((0[1-9])|1\d|2\d|30)|(02)\-((0[1-9])|1\d|2\d))(T(0\d|1\d|2[0-3])(:[0-5]\d){0,2}(.\d+)?(Z|[+\-](0\d|1[12])(:[0-5]\d)?)?)?))?

If you would like to test this RegEx, go to http://gskinner.com/RegExr/, type in ^()$ and paste the RegEx in between these parentheses. Check the box "multiline" if you want to test more than one date. Here are a few examples that will work:

 

2012

2012-11

2013-10-15

2008-03-31T16

2008-03-31T16:31

2008-03-31T16:31:15

2008-01-31T16:31:15.13

2008-01-31T16:31:15.13+02:00

2008-01-31T16:31+02:00

2008-01-31T16+02:00

2008-01-31

2008-02-29

2008-03-31

2008-04-30

2008-05-31

2008-06-30

2008-07-31

2008-08-31

2008-09-30

2008-10-31

2008-11-30

2008-12-31

 

and here are some examples that will not work anymore:

 

2008-02-31

2008-02-30

2008-04-31

2008-06-31

2008-09-31

2008-11-31

--11

--11-15

---15

 

This will make dates less ambiguous and more error proof.

Effected Elements:

/DataSets/DataSet/Units/Unit/Identifications/Identification/Date/ISODateTimeBegin

/DataSets/DataSet/Units/Unit/Identifications/Identification/Date/ISODateTimeEnd

/DataSets/DataSet/Units/Unit/SpecimenUnit/History/PreviousUnits/PreviousUnit/Date/ISODateTimeBegin

/DataSets/DataSet/Units/Unit/SpecimenUnit/History/PreviousUnits/PreviousUnit/Date/ISODateTimeEnd

/DataSets/DataSet/Units/Unit/Gathering/DateTime/ISODateTimeBegin

/DataSets/DataSet/Units/Unit/Gathering/DateTime/ISODateTimeEnd

History

#1 Updated by D. Fichtmüller over 7 years ago

  • Project changed from ABCD 3.0 Project to ABCD
  • Subject changed from Unit Extension: Change DateTimeISO to exclude impossible dates to Change DateTimeISO to exclude impossible dates
  • Category set to XML Schema
  • Parent task set to #476

#2 Updated by L. Lertsutham about 7 years ago

  • Description updated (diff)

Also available in: Atom PDF