distance API design
doodlewind opened this issue · comments
For now the distance
method returns a Miment object, which produces confusing result without extra args formatting. Is this behavior by design or can be optimized?
I can think of some alternatives:
- Make
distance
also "computed" methods, returning formatted timestamp or date field, instead of Miment object. In this case we can't add offset to a date distance unless parsing it again. - Add specific props in Miment instance marking whether it stands for distance, then workaround it on formatting. e.g, we can format distance instance into milliseconds by default, instead of raw
Date.toString
. I'm not sure about side effects of this approach.
See also difference
API in Moment.js.
cc @noahlam