3 ms·
The article is about naming the method. The fact that dates are messy means a clean API is difficult/impossible. I think plus() is a name that is good enough.
by brianpan 5y ago
The article is about naming the method. The fact that dates are messy means a clean API is difficult/impossible.
I think plus() is a name that is good enough. I can't think of a better name that will help the user understand what will happen in the 2/28 + 1 month case. That's asking too much of a method name. That's what docs are for.
- opheliate 5y agoPerhaps .dateAfter(1 month) would be more appropriate? I sympathise with the author in finding the violation of associativity of “plus” a bit jarring.