Skip to content

Commit

Permalink
Merge pull request #25 from FeatureServer/bug/date-field
Browse files Browse the repository at this point in the history
make date fields show up in esri client
  • Loading branch information
thomas-hervey authored and dmfenton committed Jun 26, 2017
2 parents e0175bc + f24b798 commit 2a82d62
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 34 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## Unreleased
### Fixed
* Date fields show up in webmap viewer

## [2.3.3] - 2017-06-20
### Fixed
* Use indexOf instead of includes to compile to es5
Expand Down
7 changes: 3 additions & 4 deletions src/fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ const moment = require('moment')
module.exports = fields

/** @type {Array} accepted date formats used by moment.js */
const DATE_FORMATS = [
moment.ISO_8601
]
const DATE_FORMATS = [moment.ISO_8601]

/**
* returns esri field type based on type of value passed
Expand Down Expand Up @@ -45,9 +43,10 @@ function isInt (value) {
function fields (props, template, options) {
const fields = Object.keys(props).map((key, i) => {
const type = fieldType(props[key])
const field = {name: key, type: type, alias: key}
const field = { name: key, type: type, alias: key }

if (type === 'esriFieldTypeString') field.length = 128
else if (type === 'esriFieldTypeDate') field.length = 36
return field
})
if (template === 'layer' && Object.keys(props).indexOf('OBJECTID') < 0) {
Expand Down
69 changes: 40 additions & 29 deletions templates/layer.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,20 @@
{
"currentVersion": 10.21,
"currentVersion": 10.31,
"id": 0,
"name": "Not Set",
"type": "Feature Layer",
"displayField": "OBJECTID",
"description": "This is a feature service powered by https://github.com/featureserver/featureserver",
"copyrightText": " ",
"defaultVisibility": true,
"relationships": [],
"isDataVersioned": false,
"supportsRollbackOnFailureParameter": true,
"supportsStatistics": true,
"supportsAdvancedQueries": true,
"advancedQueryCapabilities": {
"supportsPagination": true,
"supportsQueryWithDistance": true,
"supportsReturningQueryExtent": true,
"supportsStatistics": true,
"supportsOrderBy": true,
"supportsDistinct": true
},
"geometryType": "esriGeometryPoint",
"copyrightText": " ",
"parentLayer": null,
"subLayers": null,
"minScale": 0,
"maxScale": 0,
"drawingInfo": {
"renderer": {},
"labelingInfo": null
},
"defaultVisibility": true,
"extent": {
"xmin": -180,
"ymin": -90,
Expand All @@ -33,25 +25,44 @@
"latestWkid": 4326
}
},
"drawingInfo": {
"renderer": {},
"labelingInfo": null
"hasAttachments": false,
"htmlPopupType": "esriServerHTMLPopupTypeNone",
"displayField": "OBJECTID",
"typeIdField": null,
"fields": [],
"relationships": [],
"canModifyLayer": false,
"canScaleSymbols": false,
"hasLabels": false,
"capabilities": "Query",
"maxRecordCount": 1000,
"supportsStatistics": true,
"supportsAdvancedQueries": true,
"supportedQueryFormats": "JSON",
"ownershipBasedAccessControlForFeatures": {
"allowOthersToQuery": true
},
"useStandardizedQueries": true,
"advancedQueryCapabilities": {
"useStandardizedQueries": true,
"supportsStatistics": true,
"supportsOrderBy": true,
"supportsDistinct": true,
"supportsPagination": false,
"supportsTrueCurve": false,
"supportsReturningQueryExtent": true,
"supportsQueryWithDistance": true
},
"dateFieldsTimeReference": null,
"isDataVersioned": false,
"supportsRollbackOnFailureParameter": true,
"hasM": false,
"hasZ": false,
"allowGeometryUpdates": true,
"timeInfo": {},
"hasAttachments": false,
"htmlPopupType": "esriServerHTMLPopupTypeNone",
"objectIdField": "OBJECTID",
"globalIdField": "",
"typeIdField": "",
"fields": [],
"types": [],
"templates": [],
"maxRecordCount": 1000,
"supportedQueryFormats": "JSON",
"hasStaticData": true,
"capabilities": "Query",
"dateFieldsTimeReference": null
"timeInfo": {}
}
2 changes: 1 addition & 1 deletion templates/server.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"currentVersion": 10.21,
"currentVersion": 10.31,
"serviceDescription": "This is a feature service exposed with Koop, an open source project that turns APIs into features. Service Description information may not be available for all services. For more information, check out https://github.com/koopjs/koop ",
"hasVersionedData": false,
"supportsDisconnectedEditing": false,
Expand Down

0 comments on commit 2a82d62

Please sign in to comment.