Skip to content
Snippets Groups Projects
Commit e8f05a25 authored by Tom Robinson's avatar Tom Robinson
Browse files

Fix: Lat/Lon no longer formatted with fixed number of decimals

parent a2291703
Branches
Tags
No related merge requests found
......@@ -4,7 +4,7 @@ import moment from "moment";
import Humanize from "humanize";
import React from "react";
import { isDate, isNumber } from "metabase/lib/schema_metadata";
import { isDate, isNumber, isCoordinate } from "metabase/lib/schema_metadata";
import { parseTimestamp } from "metabase/lib/time";
const PRECISION_NUMBER_FORMATTER = d3.format(".2r");
......@@ -101,7 +101,7 @@ export function formatValue(value, options = {}) {
} else if (typeof value === "string") {
return value;
} else if (typeof value === "number") {
if (column && (column.special_type === "latitude" || column.special_type === "longitude")) {
if (isCoordinate(column)) {
return DECIMAL_DEGREES_FORMATTER(value);
} else {
return formatNumber(value, options);
......
......@@ -113,6 +113,8 @@ export const isNumericBaseType = (field) => isa(field && field.base_type, TYPE.N
// ZipCode, ID, etc derive from Number but should not be formatted as numbers
export const isNumber = (field) => (field.special_type == null || field.special_type === TYPE.Number);
export const isCoordinate = (field) => isa(field && field.special_type, TYPE.Coordinate);
// operator argument constructors:
function freeformArgument(field, table) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment