haxxnz / vaxxnz

NZ COVID Vaccination Finder - community project
https://vaxx.nz
MIT License
81 stars 44 forks source link

RangeError: style must be either "decimal", "percent", or "currency" when Walk-In/Drive-Thru #317

Closed isaacy2012 closed 2 years ago

isaacy2012 commented 2 years ago

Describe the bug Page does not load at all, console shows RangeError: style must be either "decimal", "percent", or "currency" - locale.ts:56

To Reproduce Steps to reproduce the behavior:

  1. Go to vaxx.nz
  2. Click on 'Walk-In/Drive-Thru' on Sunday 2:45pm
  3. Page does not load properly

Screenshots If applicable, add screenshots to help explain your problem.

Device:

Additional context These are the logs from the console, and the code that seems to have the error.

Screen Shot 2021-10-24 at 3 00 56 PM Screen Shot 2021-10-24 at 3 03 22 PM Screen Shot 2021-10-24 at 3 01 16 PM
noway commented 2 years ago

@isaacy2012 can't reproduce on Safari Version 15.0 (16612.1.29.41.4, 16612)

what version you are on?

isaacy2012 commented 2 years ago

My apologies, didn't put the version number. I am on Version 14.0.2 (16610.3.7.1.9). Bug still reproducible on my end.

isaacy2012 commented 2 years ago

RangeError: style must be either "decimal", "percent", or "currency"

Similar issue seen here - may be a compatibility issue with older browsers? https://stackoverflow.com/questions/60566942/why-doesnt-intl-numberformat-work-with-units-in-safari-and-firefox

noway commented 2 years ago

@isaacy2012 can you try https://deploy-preview-318--vaxxnz.netlify.app/locations see if it fixes it

isaacy2012 commented 2 years ago

Yes, now works great, but distances are formatted without rounding. Perhaps adding .toFixed(2) would yield more sensible results?

Screen Shot 2021-10-24 at 5 36 59 PM
noway commented 2 years ago

@isaacy2012 should be fixed now. Thanks a lot for the report, appreciate it!