react-intl-formatted-duration icon indicating copy to clipboard operation
react-intl-formatted-duration copied to clipboard

Setting unitDisplay="narrow" Breaks on Safari

Open ghost opened this issue 4 years ago • 1 comments

Scenario:

  1. create a component eg and open in safari
   return ( <FormattedDuration seconds={50} format="{hours} {minutes} {seconds}" unitDisplay="narrow" />);
}```
2. observe error:
[Error] RangeError: style must be either "decimal", "percent", or "currency" 

3. remove unitDisplay="narrow"
4. observe working

Desired behaviour:
unitDisplay="narrow" working in Safari.

unitDisplay="narrow" does currently work in Chrome and Safari

ghost avatar Dec 08 '20 19:12 ghost

According to this answer in StackOverflow, it's because Safari is implementing an older specification that doesn't allow 'unit' as a style. Is there a possible workaround for this?

carles-codony-manomano avatar Feb 08 '21 16:02 carles-codony-manomano