Skip to content
Snippets Groups Projects
Commit b56c03fd authored by Lewis Liu's avatar Lewis Liu
Browse files

Fixed timestamps being available on numeric field types

parent 3aa75ba1
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,7 @@ import Select from "metabase/components/Select.jsx";
import * as MetabaseCore from "metabase/lib/core";
import { titleize, humanize } from "metabase/lib/formatting";
import { isNumeric } from "metabase/lib/schema_metadata";
import { isNumericBaseType } from "metabase/lib/schema_metadata";
import _ from "underscore";
......@@ -77,7 +77,7 @@ export default class Column extends Component {
let specialTypes = MetabaseCore.field_special_types.slice(0);
specialTypes.push({'id': null, 'name': 'No special type', 'section': 'Other'});
// if we don't have a numeric base-type then prevent the options for unix timestamp conversion (#823)
if (!isNumeric(this.props.field)) {
if (!isNumericBaseType(this.props.field)) {
specialTypes = specialTypes.filter((f) => !(f.id && f.id.startsWith("timestamp_")));
}
......
......@@ -109,6 +109,9 @@ export const isCategory = isFieldType.bind(null, CATEGORY);
export const isDimension = (col) => (col && col.source !== "aggregation");
export const isMetric = (col) => (col && col.source !== "breakout") && isNumeric(col);
export const isNumericBaseType = (field) => TYPES[NUMBER].base
.some(type => type === field.base_type);
// operator argument constructors:
function freeformArgument(field, table) {
......
......@@ -3,7 +3,7 @@ import React, { Component, PropTypes } from "react";
import { Link } from "react-router";
import * as MetabaseCore from "metabase/lib/core";
import { isNumeric } from "metabase/lib/schema_metadata";
import { isNumericBaseType } from "metabase/lib/schema_metadata";
import i from 'icepick';
......@@ -53,7 +53,7 @@ const Field = ({
'name': 'No field type',
'section': 'Other'
})
.filter(type => !isNumeric(field) ?
.filter(type => !isNumericBaseType(field) ?
!(type.id && type.id.startsWith("timestamp_")) :
true
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment