fixes issue with treating undefined value as string in properties api module
@@ -72,17 +72,13 @@ const formatPropertyDateValue = (property: keyof IDatasetProperties, value: any)
}
if (property === 'dumpdate') {
- return [
- ['-', 0, 4],
- ['-', 4, 6],
- [' ', 6, 8],
- [':', 8, 10],
- [':', 10, 12],
- ['', 12, 14]
- ].reduce((dateString, props) => {
- const [postfix, ...range] = props;
- return dateString + value.substring(...range) + postfix;
- }, '');
+ return [['-', 0, 4], ['-', 4, 6], [' ', 6, 8], [':', 8, 10], [':', 10, 12], ['', 12, 14]].reduce(
+ (dateString, props: [string, number, number]): string => {
+ const [postfix, start, end] = props;
+ return value ? dateString + ('' + value).substring(start, end) + postfix : dateString;
+ },
+ ''
+ );
}
return value;
