question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remove currency property on number in JTS

See original GitHub issue

I am considering removing the currency property on the number type as I am unclear on its exact use e.g.:

  • how should this be parsed or is parsing “undefined” other than that this is a currency (does that just mean strip all non-numeric characters
  • are you supposed to be able to determine the currency

I believe it was introduced by @pwalsh here: https://github.com/dataprotocols/dataprotocols/commit/d8f80414964f8ecef186679f500d17554c4135f5#diff-8bee37e143f0d0ee3d1c0bc8eab91a5eR252

One option is that this is just saying: hey this is a currency and its up to you to parse but we should then make the explicit.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:27 (27 by maintainers)

github_iconTop GitHub Comments

1reaction
ezweltycommented, Jul 15, 2017

Having read through several of the issues on the topic of numbers… may I make a suggestion?

Numbers should be numeric. Currencies and percentages are a type of unit, and these should be defined in the metadata, not the data. If it’s really necessary to allow publishers to create bloated numeric data that won’t parse properly using standard tools… then bareNumber seems like a reasonable option.

Side note: I would also advocate for the removal of groupChar (default: none) and either the removal of decimalChar (default: “.”) or allow only “.” or “,” as possible values. See https://en.wikipedia.org/wiki/Decimal_mark#Current_standards.

0reactions
rufuspollockcommented, Jul 30, 2017

I guess I would have assumed that anyone writing a json file would also be capable of using find-and-replace to strip spurious characters.

@ezwelty consider a publisher who is expert but is packaging an upstream data file they don’t control. That is actually a common case. Often there is a strong aversion to changing that data file (e.g. it may come from another government department and it is important it is not altered as it is official). In this case the publisher is expert but they can’t change the data.


-$1.00

That is a good example. You could address if written as $-1.00 which is imperfect but which we might have to support for now.

BTW I’m really impressed with your corner case identification – please keep your feedback coming it is really valuable 🍕 👍 💯 🥇

@roll i think we want to get stuff around bareNumber into the implementor guide.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Remove currency symbol from string and convert to a number ...
I found this very helpful var currency = "-$4,400.50"; var number = Number(currency.replace(/[^0-9\.-]+/g,""));. Convert (Currency) String ...
Read more >
Removing currency symbols - GrowthPenguin
Use my method for removing currency symbols to increase conversions. ... The property returns and sets the HTML markup as a string.
Read more >
in the united states bankruptcy court - GovInfo
Upon timely motion of a party in a proceeding based upon a State law claim or. State law cause of action, related to...
Read more >
JORDAN TAX SERVICE, INC.
DO NOT USE QUOTATION MARKS ANYWHERE WITHIN THE FILE. • All numeric/currency fields may contain numbers and decimal points only. No commas, parentheses...
Read more >
Hibernate ORM 5.3.28.Final User Guide - Red Hat on GitHub
Querying for revisions of entity including property names that were modified; 21.14. ... Since Hibernate has no knowledge how to persist the Money...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found