diff --git a/packages/controlled-vocabulary/package.json b/packages/controlled-vocabulary/package.json index 071e7d42..39ac0755 100644 --- a/packages/controlled-vocabulary/package.json +++ b/packages/controlled-vocabulary/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/controlled-vocabulary", - "version": "2.1.2", + "version": "2.1.3", "description": "A package of components to allow user to configure dropdown elements. Use with the \"controlled_vocabulary\" gem.", "license": "MIT", "main": "./dist/index.cjs.js", @@ -23,8 +23,8 @@ "underscore": "^1.13.2" }, "peerDependencies": { - "@performant-software/semantic-components": "^2.1.2", - "@performant-software/shared-components": "^2.1.2", + "@performant-software/semantic-components": "^2.1.3", + "@performant-software/shared-components": "^2.1.3", "react": ">= 16.13.1 < 19.0.0", "react-dom": ">= 16.13.1 < 19.0.0" }, diff --git a/packages/core-data/package.json b/packages/core-data/package.json index ff04a6a9..90866f31 100644 --- a/packages/core-data/package.json +++ b/packages/core-data/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/core-data", - "version": "2.1.2", + "version": "2.1.3", "description": "A package of components used with the Core Data platform.", "license": "MIT", "main": "./dist/index.cjs.js", @@ -38,7 +38,7 @@ "underscore": "^1.13.2" }, "peerDependencies": { - "@performant-software/geospatial": "^2.1.2", + "@performant-software/geospatial": "^2.1.3", "@peripleo/maplibre": "^0.5.2", "@peripleo/peripleo": "^0.5.2", "react": ">= 16.13.1 < 19.0.0", diff --git a/packages/geospatial/package.json b/packages/geospatial/package.json index 68508c4f..7025d174 100644 --- a/packages/geospatial/package.json +++ b/packages/geospatial/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/geospatial", - "version": "2.1.2", + "version": "2.1.3", "description": "A package of components for all things map-related.", "license": "MIT", "main": "./dist/index.cjs.js", diff --git a/packages/semantic-ui/package.json b/packages/semantic-ui/package.json index 61c35a79..b9236d58 100644 --- a/packages/semantic-ui/package.json +++ b/packages/semantic-ui/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/semantic-components", - "version": "2.1.2", + "version": "2.1.3", "description": "A package of shared components based on the Semantic UI Framework.", "license": "MIT", "main": "./dist/index.cjs.js", @@ -35,7 +35,7 @@ "zotero-translation-client": "^5.0.1" }, "peerDependencies": { - "@performant-software/shared-components": "^2.1.2", + "@performant-software/shared-components": "^2.1.3", "@samvera/clover-iiif": "^2.3.2", "react": ">= 16.13.1 < 19.0.0", "react-dnd": "^11.1.3", diff --git a/packages/semantic-ui/src/components/FuzzyDate.js b/packages/semantic-ui/src/components/FuzzyDate.js index affd41c3..4c0fc763 100644 --- a/packages/semantic-ui/src/components/FuzzyDate.js +++ b/packages/semantic-ui/src/components/FuzzyDate.js @@ -41,6 +41,7 @@ type DateComponent = { type Props = { calendar?: string, + centered?: boolean, date: DateInput, description?: boolean, locale?: string, @@ -339,6 +340,7 @@ class FuzzyDate extends Component { { (mountNode) => ( { + if (!date) { + return null; + } + + if (!(date.description || date.start_date)) { + return null; + } + + let calendar = cal; + + if (!calendar) { + const locale = Browser.isBrowser() && navigator.language; + calendar = new Calendar(locale, DEFAULT_CALENDAR); + } + + // Use the description, if provided + if (date.description) { + return date.description; + } + + // Otherwise, format the start and end dates + const dateView = []; + + if (date.start_date) { + const parsed = calendar.parseDate(date.start_date); + dateView.push(calendar.format(parsed, date.accuracy)); + } + + if (date.range && date.end_date) { + const parsed = calendar.parseDate(date.end_date); + dateView.push(calendar.format(parsed, date.accuracy)); + } + + return _.isEmpty(dateView) ? null : dateView.join(DATE_SEPARATOR); +}; + +export default { + getDateView +}; diff --git a/packages/user-defined-fields/package.json b/packages/user-defined-fields/package.json index 7ece16ff..39c6750d 100644 --- a/packages/user-defined-fields/package.json +++ b/packages/user-defined-fields/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/user-defined-fields", - "version": "2.1.2", + "version": "2.1.3", "description": "A package of components used for allowing end users to define fields on models. Use with the \"user_defined_fields\" gem.", "license": "MIT", "main": "./dist/index.cjs.js", @@ -23,8 +23,8 @@ "underscore": "^1.13.2" }, "peerDependencies": { - "@performant-software/semantic-components": "^2.1.2", - "@performant-software/shared-components": "^2.1.2", + "@performant-software/semantic-components": "^2.1.3", + "@performant-software/shared-components": "^2.1.3", "react": ">= 16.13.1 < 19.0.0", "react-dom": ">= 16.13.1 < 19.0.0" }, diff --git a/packages/visualize/package.json b/packages/visualize/package.json index 9fd57587..a738b82f 100644 --- a/packages/visualize/package.json +++ b/packages/visualize/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/visualize", - "version": "2.1.2", + "version": "2.1.3", "description": "A package of components used for data visualization", "license": "MIT", "main": "./dist/index.cjs.js", diff --git a/react-components.json b/react-components.json index e1fff23d..24aad51a 100644 --- a/react-components.json +++ b/react-components.json @@ -8,5 +8,5 @@ "packages/user-defined-fields", "packages/visualize" ], - "version": "2.1.2" + "version": "2.1.3" }