Intl.NumberFormat space character does not match

前端 未结 2 1426
礼貌的吻别
礼貌的吻别 2020-12-11 08:39

I\'m running into an issue where Intl.NumberFormat is formatting the space character in some way that is different from what Jest is expecting. Tests against t

2条回答
  •  鱼传尺愫
    2020-12-11 08:54

    NumberFormat use small non-breaking space (\u202f) for thousand separator and normal non-breaking space beforece currency (\xa0)

      expect(new Intl.NumberFormat("fr-FR", {
        style: "currency",
        currency: "EUR",
      }).format(126126)).toBe("126\u202f126,00\xa0€")
    

提交回复
热议问题