Miment icon indicating copy to clipboard operation
Miment copied to clipboard

distance API design

Open doodlewind opened this issue 7 years ago • 1 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.

doodlewind avatar Apr 19 '18 03:04 doodlewind

cc @noahlam

doodlewind avatar Apr 19 '18 03:04 doodlewind