Skip to content

distance API design #8

Description

@doodlewind

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions