Poll: Would you find these methods helpful in the CodeIgniter 4 Time class? You do not have permission to vote in this poll. |
|||
Yes, this improves readability and simplifies code. | 7 | 87.50% | |
No, the current methods are sufficient. | 1 | 12.50% | |
Total | 8 vote(s) | 100% |
* You voted for this item. | [Show Results] |
Proposal: Add isPast() and isFuture() to CodeIgniter 4 Time Class |
I would argue that it doesn't make the code any more readable. Requiring a dev to input Time::now() makes it obvious the method is used for a temporal comparison.
It certainly qualifies as a convenience/efficiency method but its use case is already covered by the more general isBefore, isAfter. If someone specifically desired these methods coudn't they create their own Time class that uses TimeTrait and add these methods? Am I missing something that makes these methods necessary? Wouldn't it also be possible to refactor isBefore and isAfter to check if the passed time is null and assume Time::now() so that isPast and isFuture aren't required at all? The point of this is to say that isBefore() and isAfter() is no less confusing than isPast() or isFuture() without a parameter. You're trying to use the idea of isPresent in your mind to indicate that Time::now() is obvious, but I could also say that there is an imaginary isNow that relates to isBefore and isAfter. |
Messages In This Thread |
Proposal: Add isPast() and isFuture() to CodeIgniter 4 Time Class - by datamweb - 02-19-2025, 05:15 PM
RE: Proposal: Add isPast() and isFuture() to CodeIgniter 4 Time Class - by michalsn - 02-20-2025, 12:00 AM
RE: Proposal: Add isPast() and isFuture() to CodeIgniter 4 Time Class - by grimpirate - 02-20-2025, 03:38 PM
RE: Proposal: Add isPast() and isFuture() to CodeIgniter 4 Time Class - by michalsn - 02-20-2025, 11:17 PM
|