3 ms·
Any date information collected from non-computer processes can have missing or incorrect dates (e.g., doctor's notes, or a historical record saying "1920s"). De
by vharuck 5y ago
Any date information collected from non-computer processes can have missing or incorrect dates (e.g., doctor's notes, or a historical record saying "1920s"). Despite that, you may need to do comparisons between them. This lets us keep the dates in one field, do the normal logic with complete values, and do some limited logic with incomplete ones. For example:
# This is true
Date("192X-XX-XX") >= Date("1920-01-01")
# This is false
Date("192X-XX-XX") < Date("1920-01-01")
# This is unknown
Date("192X-XX-XX") == Date("1920-01-01")
I don't like splitting dates across multiple fields and writing custom logic. It'd be nicer to have a standard and (eventually) a good library to lean on.
- Archelaos 5y agoI think there is a problem with the meaning of the '==' sign here. You are using algebraic notation where we are really dealing with ordered sets and their members. So '==' meaning equivalence is not very useful here. 'Date("192X-XX-XX")' denotes the interval [Date("1920-01-01") ... Date("1929-12-31")]. So '<', '>', '==' should best be defined in terms of ordered sets: d < I means date d is before any date in I d > I means date d is after any date in I d == I means date d is included in I This would make your last equation 'true'. If instead you rather prefer to leave 'd == I' undefined, I could hardly find it convincing that you assign a truth value to '<='.
- vharuck 5y agoI've corrected the first date comparison to be ">=". Thanks for pointing that out. >'Date("192X-XX-XX")' denotes the interval [Date("1920-01-01") ... Date("1929-12-31")] The partial date is not the set, but a single date that is in a set. There is notation for sets of dates: # Each means a single day in the 1920s 192X-XX-XX [1920-01-01..1929-12-31] # A collection of all days in the 1920s {1920-01-01..1929-12-31}