Skip to content

Documentation could be misleading #264

Open
@DanielDornhardt

Description

@DanielDornhardt

Hello!

Thank you for this fine library which ich making my life easier as it is right now, so I'm very happy :)

When i started working with my currencies right now I fell into a little trap:

I assumed currency.js would work a bit like moment.js, which also encapsulates some data to make it more easy to work with. Now moment() has it's own way of doing things, by always applying changes to the current date object, eg. moment().add(1, 'day').add(1, 'day').add(1, 'day') will give you a date three days from now buy it'll have modified the original moment() instance, so you need to clone it around with moment(someOtherMoment) before you do any changes if you want to keep the original moment around.

So far so good, you probably know that, and currency.js works differently, that's fine.

But the documentation (from https://currency.js.org/ ) seems to be a bit misleading in this regard, because for the methods the descriptions are written like this:(

currency.add( value )

Adds a string, number, or currency value to the current currency instance.

-> That to me implies that the current instance will be changed, which it won't do, it'll return a new instance with the new value.

I think rewording this slightly, or adding a few examples to the top how to work with multiple currency values and eg. add and multiply them together would be nice.

I'd love to help out but unfortunately I am scrambling to get my feature done at the moment, but I thought I'd leave this here as feedback + to show that people are happy using your library as well.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions