Hello guys, i need some help with making this Api workflow to function properly.
In my app the Users can create a thing (Need) that has a boolean field “Expiry”. I would like to change that field to “yes” when the date from Date/Time picker = Current Date/time.
Those two times will (for all intents and purposes) NEVER be equal. Times are accurate down to the millisecond.
What you’re looking to do is set expired to true if expiry date/time is LESS THAN current date/time.
But please note: As I always point out to people trying to do this type of thing, why even bother setting some boolean state for “expired”? Expired is a derived value (that is, it can always be calculated).
At any time, you can check if expiry_date is less than the current date/time. If that condition is true, your thing is expired. If that condition is NOT true, your you thing is not expired.
(And of course, you can think of this conversely as well: If current date/time is less than expiry_date, then the thing is not expired.)
If you ask me why I chose the boolean type for the Expiry field, is because it seemed more logical for what i learned so far. (and believe me I have much to learn ).
When a user create a Need (aka a JOB) he must tell when he want to be done (the Cuando field). And if he don´t find any worker until that Date, the Expiry is updating to “yes”.
Do you think it’s counterproductive to have this boolean expire field in the data?