# Format Number similar to \`toLocaleString()\`

**URL:** <https://discourse.elm-lang.org/t/format-number-similar-to-tolocalestring/6626>\
**Category:** Learn\
**Created:** [December 13, 2020, 10:25am UTC](https://discourse.elm-lang.org/t/format-number-similar-to-tolocalestring/6626 "2020-12-13T10:25:10Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mickeyvip](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/mickeyvip/32/1910_2.png) [@mickeyvip](https://discourse.elm-lang.org/u/mickeyvip)\
**Post date:** [December 13, 2020, 10:25am UTC](https://discourse.elm-lang.org/t/format-number-similar-to-tolocalestring/6626/1 "2020-12-13T10:25:10Z")

</div>

Hello.

I was wondering if there is a number formatting in Elm core library. I couldn’t find it (saw several community packages that do it).

I want to format numbers similar to JavaScripts’ `myNum.toLocaleString()`.

Thank you.

---

<div class="post-metadata">

**Author:** ![pdamoc](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/pdamoc/32/36_2.png) [@pdamoc](https://discourse.elm-lang.org/u/pdamoc)\
**Post date:** [December 13, 2020, 10:57am UTC](https://discourse.elm-lang.org/t/format-number-similar-to-tolocalestring/6626/2 "2020-12-13T10:57:32Z")

</div>

Have you seen [elm-format-number](https://package.elm-lang.org/packages/cuducos/elm-format-number/8.1.4/) ?

---

<div class="post-metadata">

**Author:** ![mickeyvip](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/mickeyvip/32/1910_2.png) [@mickeyvip](https://discourse.elm-lang.org/u/mickeyvip)\
**Post date:** [December 13, 2020, 1:50pm UTC](https://discourse.elm-lang.org/t/format-number-similar-to-tolocalestring/6626/3 "2020-12-13T13:50:27Z")

</div>

Yes, I’ve seen it.

I was hoping that Elm has it built in.

Thank you @pdamoc .

---

<div class="post-metadata">

**Author:** ![Laurent](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/laurent/32/5725_2.png) [@Laurent](https://discourse.elm-lang.org/u/Laurent)\
**Post date:** [December 14, 2020, 9:11pm UTC](https://discourse.elm-lang.org/t/format-number-similar-to-tolocalestring/6626/4 "2020-12-14T21:11:18Z")

</div>

Maybe [custom elements](https://guide.elm-lang.org/interop/custom_elements.html) could be a solution ?

---

<div class="post-metadata">

**Author:** ![mickeyvip](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/mickeyvip/32/1910_2.png) [@mickeyvip](https://discourse.elm-lang.org/u/mickeyvip)\
**Post date:** [December 15, 2020, 4:52pm UTC](https://discourse.elm-lang.org/t/format-number-similar-to-tolocalestring/6626/5 "2020-12-15T16:52:05Z")

</div>

Hi @Laurent,

That’s a very interesting idea! I like it.

Thank you.

---

<div class="post-metadata">

**Author:** ![hans-helmut](https://avatars.discourse-cdn.com/v4/letter/h/d9b06d/32.png) [@hans-helmut](https://discourse.elm-lang.org/u/hans-helmut)\
**Post date:** [December 16, 2020, 5:34pm UTC](https://discourse.elm-lang.org/t/format-number-similar-to-tolocalestring/6626/6 "2020-12-16T17:34:39Z")

</div>

Interesting to see, that you “hang” at a similar point like me some time ago: [https://github.com/hans-helmut/elm-timei18n](https://github.com/hans-helmut/elm-timei18n)

---

<div class="post-metadata">

**Author:** ![Herteby](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/herteby/32/1329_2.png) [@Herteby](https://discourse.elm-lang.org/u/Herteby)\
**Post date:** [December 16, 2020, 5:42pm UTC](https://discourse.elm-lang.org/t/format-number-similar-to-tolocalestring/6626/7 "2020-12-16T17:42:57Z")

</div>

Using formats based system settings isn’t always that great though. We had an issue with some users being confused and failing to complete our forms, because they didn’t understand that the time inputs were using AM/PM instead of 24h, because of their own device’s locale settings 😛

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/elm_lang/original/1X/50a05e53677a2c3b47776d7abd0f113eb50193a1.png) [@system](https://discourse.elm-lang.org/u/system)\
**Post date:** [December 26, 2020, 5:43pm UTC](https://discourse.elm-lang.org/t/format-number-similar-to-tolocalestring/6626/8 "2020-12-26T17:43:00Z")

</div>

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
