Welcome Guest, Not a member yet? Register   Sign In
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.
87.50%
7 87.50%
No, the current methods are sufficient.
12.50%
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
#4

@grimpirate  I see your point about isBefore(Time::now()) being explicit, but I still believe isPast() and isFuture() improve readability and developer experience. IMO these methods are intuitive and reduce repetitive code.

Changing the method signature of isBefore() and isAfter() to accept null and assume Time::now() does not improve readability - it actually makes things more confusing. The method name isBefore() without a parameter is not intuitive - it doesn’t clearly convey that it’s comparing against Time::now(). On the other hand, isPast() and isFuture() are IMO immediately clear in meaning.

While extending the class is an option, this can be a small yet useful addition that benefits most developers without adding complexity to the framework.
Reply


Messages In This Thread
RE: Proposal: Add isPast() and isFuture() to CodeIgniter 4 Time Class - by michalsn - 02-20-2025, 11:17 PM



Theme © iAndrew 2016 - Forum software by © MyBB