Skip to content

Commit 4c9313a

Browse files
authored
Merge pull request #897 from jason-fox/patch-2
Add common NGSI-LD constants
2 parents bd172c0 + 9d65c09 commit 4c9313a

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

lib/constants.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@
2323
* Modified by: Daniel Calvo - ATOS Research & Innovation
2424
*/
2525

26-
const LOCATION_TYPE = 'geo:point';
2726
const LOCATION_DEFAULT = '0, 0';
28-
const DATETIME_TYPE = 'DateTime';
2927
const DATETIME_DEFAULT = '1970-01-01T00:00:00.000Z';
3028
const ATTRIBUTE_DEFAULT = ' ';
3129

@@ -36,10 +34,18 @@ const ATTRIBUTE_DEFAULT = ' ';
3634
* @return {String} A default value to use in the entity
3735
*/
3836
function getInitialValueForType(type) {
39-
switch (type) {
40-
case LOCATION_TYPE:
37+
switch (type.toLowerCase()) {
38+
case 'geoproperty':
4139
return LOCATION_DEFAULT;
42-
case DATETIME_TYPE:
40+
case 'point':
41+
return LOCATION_DEFAULT;
42+
case 'geo:point':
43+
return LOCATION_DEFAULT;
44+
case 'datetime':
45+
return DATETIME_DEFAULT;
46+
case 'date':
47+
return DATETIME_DEFAULT;
48+
case 'time':
4349
return DATETIME_DEFAULT;
4450
default:
4551
return ATTRIBUTE_DEFAULT;

0 commit comments

Comments
 (0)