diff --git a/specifyweb/frontend/js_src/lib/components/QueryBuilder/Line.tsx b/specifyweb/frontend/js_src/lib/components/QueryBuilder/Line.tsx index 792da37d946..1991acdb852 100644 --- a/specifyweb/frontend/js_src/lib/components/QueryBuilder/Line.tsx +++ b/specifyweb/frontend/js_src/lib/components/QueryBuilder/Line.tsx @@ -158,6 +158,16 @@ export function QueryLine({ : (parser.type ?? 'text'); canOpenMap = fieldName === 'latitude1' || fieldName === 'longitude1'; + + // Special case for age field with ageRange filter non-numeric validation + if (fieldType === 'age' && field.filters.some((filter) => filter.type === 'ageRange')) { + parser = { + ...parser, + type: 'number', + step: "any" + }; + } + } else if (isMapped) fieldType = isFormatted && mappingPath.at(-1) === `${schema.referenceSymbol}1` diff --git a/specifyweb/frontend/js_src/lib/components/WbPlanView/mappingPreview.ts b/specifyweb/frontend/js_src/lib/components/WbPlanView/mappingPreview.ts index fd9d35f8dec..c6627c2c6a0 100644 --- a/specifyweb/frontend/js_src/lib/components/WbPlanView/mappingPreview.ts +++ b/specifyweb/frontend/js_src/lib/components/WbPlanView/mappingPreview.ts @@ -172,10 +172,18 @@ export function generateMappingPathPreview( : [tableNameNonEmpty]; // Special case for disambiguation: Host taxon under specific base tables - const baseTables = ['CollectionObject', 'CollectingEventAttribute', 'Determination', 'Taxon']; + const baseTables = [ + 'CollectionObject', + 'CollectingEventAttribute', + 'Determination', + 'Taxon', + ]; const hostTaxonNames = [ - 'host taxon', - tables[baseTableName]?.getField('hostTaxon')?.localization.name?.trim()?.toLowerCase() + 'host taxon', + tables[baseTableName] + ?.getField('hostTaxon') + ?.localization.name?.trim() + ?.toLowerCase(), ].filter(Boolean); const isHostTaxonCase = baseTables.includes(baseTableName) && diff --git a/specifyweb/frontend/js_src/lib/utils/parser/definitions.ts b/specifyweb/frontend/js_src/lib/utils/parser/definitions.ts index f612701d5d3..35663cde3cb 100644 --- a/specifyweb/frontend/js_src/lib/utils/parser/definitions.ts +++ b/specifyweb/frontend/js_src/lib/utils/parser/definitions.ts @@ -53,7 +53,7 @@ export const validators: IR<(value: unknown) => string | undefined> = { } as const; export type Parser = Partial<{ - readonly type: 'age' | 'checkbox' | 'date' | 'number' | 'text'; + readonly type: 'checkbox' | 'date' | 'number' | 'text'; readonly minLength: number; readonly maxLength: number; // Number, or a string date in yyyy-mm-dd format