Skip to content
Snippets Groups Projects
Commit b9052587 authored by Florian Spreckelsen's avatar Florian Spreckelsen
Browse files

Merge branch 'f-date-time' into 'dev'

FIX #183

See merge request !37
parents 45cf506d 5293a4d0
No related branches found
No related tags found
2 merge requests!41REL: update changelog, bump version of pom.xml, update DEPENDENCIES,!37FIX #183
Pipeline #14355 passed
......@@ -19,6 +19,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
* #183 No reasonable error when using bad datetime format.
(https://gitlab.indiscale.com/caosdb/src/caosdb-server/-/issues/183)
* #127 "nan" as value (list item) in properties with data type "LIST<DOUBLE>"
return with "Cannot parse value to double" error.
* #170 Updating an abstract list-type property with a default value fails with
......
......@@ -37,12 +37,19 @@ public class DateTimeDatatype extends AbstractDatatype {
try {
if (value instanceof UTCDateTime || value instanceof Date) {
return (DateTimeInterface) value;
} else if (value instanceof GenericValue) {
return DateTimeFactory2.valueOf(((GenericValue) value).toDatabaseString());
}
DateTimeInterface result;
if (value instanceof GenericValue) {
result = DateTimeFactory2.valueOf(((GenericValue) value).toDatabaseString());
} else {
return DateTimeFactory2.valueOf(value.toString());
result = DateTimeFactory2.valueOf(value.toString());
}
} catch (final IllegalArgumentException e) {
// Test if this is storable
result.toDatabaseString();
return result;
} catch (final UnsupportedOperationException | IllegalArgumentException e) {
throw ServerMessages.CANNOT_PARSE_DATETIME_VALUE;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment