Stream: implementers
Topic: Field to hold YYYY -- what is the "right" way?
Saul Kravitz (Feb 14 2022 at 17:05):
I need to define a field to hold a value that is only a YYYY.
What is the "right" way?
- dateTime. (is there a way to constrain to only the year part)
- date (is there a way to constrain to only the year part)?
- string (lmited to 4 characters)
- integer with range limited to four digits?
- other?
Thanks,
David Pyke (Feb 14 2022 at 17:07):
Two ways are available, date with an invariant forcing only year or date with no invariant but you ignore anything but the year section
Saul Kravitz (Feb 14 2022 at 17:41):
@David Pyke thx
So, for the 2nd option, it is just documentation on the use of the date field?
David Pyke (Feb 14 2022 at 17:44):
Yes, that's the simple way and people will know what to do and what to expect if they don't follow instructions
Saul Kravitz (Feb 14 2022 at 17:48):
@David Pyke Good suggestions. Thanks. Are they documented anywhere so that you could have told me RTFM?
David Pyke (Feb 14 2022 at 17:51):
Not really, no. These are just things that others have asked in the past. A manual like this would fill a whole separate internet
Grahame Grieve (Feb 14 2022 at 22:01):
searching zulip is the best we haev at the moment. The quickest invariant for this is set max and min length
Last updated: Apr 12 2022 at 19:14 UTC