I tried it with Javascript but doesn't work for me neither. Probably neo4j's driver for Javascript doesn't support ipv6.
I found here https://community.neo4j.com/t5/neo4j-graph-platform/troubleshooting-connection-issues-to-neo4j/m-p/47959 that the possible solution could be setting the flag
dbms.connectors.default_listen_address=::1
but that possibly means only configuring the loopback address will be parsed from IPv6.
Memgraph reuses the Neo4J's Javascript driver so that won't work as well, but the GQLAlchemy which is able to connect to Memgraph does parse IPv6 without any problems, with the following code snippet:
from gqlalchemy import Memgraph
if __name__ == "__main__":
memgraph = Memgraph(host='0:0:0:0:0:0:0:1', port=7687)
memgraph.drop_database()
memgraph.execute("CREATE (n);")
result = next(memgraph.execute_and_fetch("MATCH (n) RETURN COUNT(n) as cnt;"))
print(result['cnt'])
The only downside is, it is built in Python, which was not your preferred choice of language.