Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • 1. This question could benefit from a list of test strings (or input bounds) to validate any answer against. 2. Currency + JS float behavior appears to be edge case risky, maybe not pain level of date/time programming but more than might expect -- Consider a library, a built-in, or a custom function accepting narrowly bounded inputs to avoid getting unexpected NaN or other errors. Commented Dec 19, 2022 at 22:48
  • You don't want to use floating point for this, but fixed point. I'm new to JS, so I can't provide more detailed information at the present time about this. Commented Feb 6, 2023 at 20:52