diff --git a/cypher-shell/src/integration-test/java/org/neo4j/shell/commands/CypherShellVerboseIntegrationTest.java b/cypher-shell/src/integration-test/java/org/neo4j/shell/commands/CypherShellVerboseIntegrationTest.java index 597f24df..d3f5f509 100644 --- a/cypher-shell/src/integration-test/java/org/neo4j/shell/commands/CypherShellVerboseIntegrationTest.java +++ b/cypher-shell/src/integration-test/java/org/neo4j/shell/commands/CypherShellVerboseIntegrationTest.java @@ -67,6 +67,16 @@ public void tearDown() throws Exception shell.execute( "MATCH (n) DETACH DELETE (n)" ); } + @Test + public void parseDuration() throws CommandException + { + //when + shell.execute( "RETURN duration({months:0.75})" ); + + //then + assertThat( linePrinter.output(), containsString( "P22DT19H51M49.5S" ) ); + } + @Test public void cypherWithNoReturnStatements() throws CommandException { diff --git a/cypher-shell/src/main/java/org/neo4j/shell/prettyprint/OutputFormatter.java b/cypher-shell/src/main/java/org/neo4j/shell/prettyprint/OutputFormatter.java index 848d28d2..474564bc 100644 --- a/cypher-shell/src/main/java/org/neo4j/shell/prettyprint/OutputFormatter.java +++ b/cypher-shell/src/main/java/org/neo4j/shell/prettyprint/OutputFormatter.java @@ -39,6 +39,7 @@ import org.neo4j.driver.types.Point; import org.neo4j.driver.types.Relationship; import org.neo4j.shell.state.BoltResult; +import org.neo4j.values.storable.DurationValue; import static java.util.Arrays.asList; import static java.util.concurrent.TimeUnit.MILLISECONDS; @@ -210,6 +211,8 @@ default String formatValue( final Value value ) return pathAsString( value.asPath() ); case POINT: return pointAsString( value.asPoint() ); + case DURATION: + return DurationValue.parse( value.toString() ).prettyPrint(); case ANY: case BOOLEAN: case BYTES: @@ -222,7 +225,6 @@ default String formatValue( final Value value ) case DATE_TIME: case LOCAL_TIME: case LOCAL_DATE_TIME: - case DURATION: case NULL: default: return value.toString();