Skip to content

Commit

Permalink
fix: safe 0 fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
TurtIeSocks committed Feb 23, 2024
1 parent 40a5c3c commit 45795a8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/services/functions/formatDistance.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export function formatDistance(
unit = useStorage.getState().settings.distanceUnit,
locale = localStorage.getItem('i18nextLng') || 'en',
) {
const distance = unit === 'miles' ? meters / METERS_PER_MILE : meters / 1000
const safe = meters || 0
const distance = unit === 'miles' ? safe / METERS_PER_MILE : safe / 1000

const numFormatter = new Intl.NumberFormat(locale, {
unitDisplay: 'short',
Expand Down

0 comments on commit 45795a8

Please sign in to comment.