{"id":7101,"date":"2025-09-09T14:18:20","date_gmt":"2025-09-09T19:18:20","guid":{"rendered":"https:\/\/frontendmasters.com\/blog\/?p=7101"},"modified":"2025-09-09T14:18:20","modified_gmt":"2025-09-09T19:18:20","slug":"unit-formatting-with-intl-in-javascript","status":"publish","type":"post","link":"https:\/\/frontendmasters.com\/blog\/unit-formatting-with-intl-in-javascript\/","title":{"rendered":"Unit Formatting with Intl in JavaScript"},"content":{"rendered":"\n<p><a href=\"https:\/\/www.raymondcamden.com\/2025\/08\/22\/unit-formatting-with-intl-in-javascript\">Raymond Camden<\/a>:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>It&#8217;s been a little while since I last blogged about my favorite web platform feature, <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Reference\/Global_Objects\/Intl\">Intl<\/a>.<\/p>\n<\/blockquote>\n\n\n\n<p>Favorite?! Big words. <\/p>\n\n\n\n<p>As someone who does technical writing, though, I get it. Let&#8217;s say you have a number, like 392, and you need to display that as megabytes. What is the absolutely correct way to show that in U.S. English? 392 MB? 392mb? 392mB? None of those, <a href=\"https:\/\/codepen.io\/chriscoyier\/pen\/VYvNzRw\">it&#8217;s actually 392MB<\/a> in the &#8220;short&#8221; format and 392 megabytes in the &#8220;long&#8221; format. I like programmatically correct answers.<\/p>\n\n\n\n<p>And better, you can change the locale and have it reformat as appropriate. Like it&#8217;s actually 392 MB for de-DE.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Raymond Camden: It&#8217;s been a little while since I last blogged about my favorite web platform feature, Intl. Favorite?! Big words. As someone who does technical writing, though, I get it. Let&#8217;s say you have a number, like 392, and you need to display that as megabytes. What is the absolutely correct way to show [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":7103,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"sig_custom_text":"","sig_image_type":"featured-image","sig_custom_image":0,"sig_is_disabled":false,"inline_featured_image":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[29],"tags":[393,3,394],"class_list":["post-7101","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-the-beat","tag-intl","tag-javascript","tag-units"],"acf":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/09\/pexels-photo-2714073.jpeg?fit=867%2C1300&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/7101","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/comments?post=7101"}],"version-history":[{"count":2,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/7101\/revisions"}],"predecessor-version":[{"id":7104,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/7101\/revisions\/7104"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/media\/7103"}],"wp:attachment":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/media?parent=7101"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/categories?post=7101"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/tags?post=7101"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}